Title: [129875] trunk/Source
Revision
129875
Author
[email protected]
Date
2012-09-28 04:21:38 -0700 (Fri, 28 Sep 2012)

Log Message

Web Inspector: make HashSet memory instrumentation non-intrusive
https://bugs.webkit.org/show_bug.cgi?id=97879

Reviewed by Vsevolod Vlasov.

Source/WebKit/chromium:

Update the test for HashSet memory instrumentation. We don't add
HashSet's private objects into the set of visited objects any more
and should update the expectation accordingly.

* tests/MemoryInstrumentationTest.cpp:
(WebCore::TEST):

Source/WTF:

Removed reportMemoryUsage declarations as a friend of HashSet and HashTable. Also
removed MemoryInstrumentationHashTable which is not needed if we don't have
access to HashSet's guts.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/HashSet.h:
(WTF):
(HashSet):
* wtf/HashTable.h:
(HashTable):
* wtf/MemoryInstrumentation.h:
(WTF::MemoryClassInfo::addPrivateBuffer):
* wtf/MemoryInstrumentationHashSet.h:
(WTF::reportMemoryUsage):
* wtf/MemoryInstrumentationHashTable.h: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (129874 => 129875)


--- trunk/Source/WTF/ChangeLog	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/ChangeLog	2012-09-28 11:21:38 UTC (rev 129875)
@@ -1,3 +1,30 @@
+2012-09-28  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: make HashSet memory instrumentation non-intrusive
+        https://bugs.webkit.org/show_bug.cgi?id=97879
+
+        Reviewed by Vsevolod Vlasov.
+
+        Removed reportMemoryUsage declarations as a friend of HashSet and HashTable. Also
+        removed MemoryInstrumentationHashTable which is not needed if we don't have
+        access to HashSet's guts.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/HashSet.h:
+        (WTF):
+        (HashSet):
+        * wtf/HashTable.h:
+        (HashTable):
+        * wtf/MemoryInstrumentation.h:
+        (WTF::MemoryClassInfo::addPrivateBuffer):
+        * wtf/MemoryInstrumentationHashSet.h:
+        (WTF::reportMemoryUsage):
+        * wtf/MemoryInstrumentationHashTable.h: Removed.
+
 2012-09-27  Anders Carlsson  <[email protected]>
 
         Remove the clang pragmas to disable warnings in Noncopyable.h

Modified: trunk/Source/WTF/GNUmakefile.list.am (129874 => 129875)


--- trunk/Source/WTF/GNUmakefile.list.am	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/GNUmakefile.list.am	2012-09-28 11:21:38 UTC (rev 129875)
@@ -82,7 +82,6 @@
     Source/WTF/wtf/MemoryInstrumentation.h \
     Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h \
     Source/WTF/wtf/MemoryInstrumentationHashSet.h \
-    Source/WTF/wtf/MemoryInstrumentationHashTable.h \
     Source/WTF/wtf/MemoryInstrumentationVector.h \
     Source/WTF/wtf/MessageQueue.h \
     Source/WTF/wtf/MetaAllocator.cpp \

Modified: trunk/Source/WTF/WTF.gypi (129874 => 129875)


--- trunk/Source/WTF/WTF.gypi	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/WTF.gypi	2012-09-28 11:21:38 UTC (rev 129875)
@@ -52,7 +52,6 @@
             'wtf/MemoryInstrumentation.h',
             'wtf/MemoryInstrumentationArrayBufferView.h',
             'wtf/MemoryInstrumentationHashSet.h',
-            'wtf/MemoryInstrumentationHashTable.h',
             'wtf/MemoryInstrumentationVector.h',
             'wtf/MessageQueue.h',
             'wtf/NonCopyingSort.h',

Modified: trunk/Source/WTF/WTF.pro (129874 => 129875)


--- trunk/Source/WTF/WTF.pro	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/WTF.pro	2012-09-28 11:21:38 UTC (rev 129875)
@@ -89,7 +89,6 @@
     MemoryInstrumentation.h \
     MemoryInstrumentationArrayBufferView.h \
     MemoryInstrumentationHashSet.h \
-    MemoryInstrumentationHashTable.h \
     MemoryInstrumentationVector.h \
     MessageQueue.h \
     MetaAllocator.h \

Modified: trunk/Source/WTF/WTF.vcproj/WTF.vcproj (129874 => 129875)


--- trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2012-09-28 11:21:38 UTC (rev 129875)
@@ -913,10 +913,6 @@
 			>
 		</File>
 		<File
-		        RelativePath="..\wtf\MemoryInstrumentationHashTable.h"
-			>
-		</File>
-		<File
 		        RelativePath="..\wtf\MemoryInstrumentationVector.h"
 			>
 		</File>

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (129874 => 129875)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2012-09-28 11:21:38 UTC (rev 129875)
@@ -40,7 +40,6 @@
 		2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
 		4330F38F15745B0500AAFA8F /* URLString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4330F38E15745B0500AAFA8F /* URLString.cpp */; };
 		4F0321BC156AA8D1006EBAF6 /* BitArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F0321BB156AA8D1006EBAF6 /* BitArray.h */; };
-		4F0BABBB1611D5F500023F66 /* MemoryInstrumentationHashTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F0BABBA1611D5F500023F66 /* MemoryInstrumentationHashTable.h */; };
 		4F1B2DB6160B44AA00586559 /* MemoryInstrumentationHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */; };
 		4F1D115415FF11BE0026E908 /* MemoryInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */; };
 		4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */; };
@@ -312,7 +311,6 @@
 		2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; };
 		4330F38E15745B0500AAFA8F /* URLString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = URLString.cpp; sourceTree = "<group>"; };
 		4F0321BB156AA8D1006EBAF6 /* BitArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitArray.h; sourceTree = "<group>"; };
-		4F0BABBA1611D5F500023F66 /* MemoryInstrumentationHashTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashTable.h; sourceTree = "<group>"; };
 		4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashSet.h; sourceTree = "<group>"; };
 		4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentation.h; sourceTree = "<group>"; };
 		4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationVector.h; sourceTree = "<group>"; };
@@ -700,7 +698,6 @@
 				4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */,
 				4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */,
 				4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */,
-				4F0BABBA1611D5F500023F66 /* MemoryInstrumentationHashTable.h */,
 				4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */,
 				A8A472CC151A825B004123FF /* MessageQueue.h */,
 				A8A472CD151A825B004123FF /* MetaAllocator.cpp */,
@@ -1155,7 +1152,6 @@
 				26E6C20D1609037300CA6AF4 /* URLUtil.h in Headers */,
 				4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */,
 				4F1B2DB6160B44AA00586559 /* MemoryInstrumentationHashSet.h in Headers */,
-				4F0BABBB1611D5F500023F66 /* MemoryInstrumentationHashTable.h in Headers */,
 				4FD8554716133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;

Modified: trunk/Source/WTF/wtf/HashSet.h (129874 => 129875)


--- trunk/Source/WTF/wtf/HashSet.h	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/wtf/HashSet.h	2012-09-28 11:21:38 UTC (rev 129875)
@@ -27,7 +27,6 @@
 namespace WTF {
 
     struct IdentityExtractor;
-    class MemoryObjectInfo;
     
     template<typename Value, typename HashFunctions, typename Traits> class HashSet;
     template<typename Value, typename HashFunctions, typename Traits>
@@ -97,7 +96,6 @@
     private:
         friend void deleteAllValues<>(const HashSet&);
         friend void fastDeleteAllValues<>(const HashSet&);
-        template<typename V, typename H, typename T> friend void reportMemoryUsage(const HashSet<V, H, T>* const&, MemoryObjectInfo*);
 
         HashTableType m_impl;
     };

Modified: trunk/Source/WTF/wtf/HashTable.h (129874 => 129875)


--- trunk/Source/WTF/wtf/HashTable.h	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/wtf/HashTable.h	2012-09-28 11:21:38 UTC (rev 129875)
@@ -307,8 +307,6 @@
         bool isNewEntry;
     };
 
-    class MemoryObjectInfo;
-
     template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
     class HashTable {
     public:
@@ -486,8 +484,6 @@
         static const int m_maxLoad = 2;
         static const int m_minLoad = 6;
 
-        template<typename K, typename V, typename E, typename H, typename T, typename KT> friend void reportMemoryUsage(const HashTable<K, V, E, H, T, KT>* const&, MemoryObjectInfo*);
-
         ValueType* m_table;
         int m_tableSize;
         int m_tableSizeMask;

Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (129874 => 129875)


--- trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-09-28 11:21:38 UTC (rev 129875)
@@ -220,6 +220,7 @@
     template<typename MapType> void addInstrumentedMapValues(const MapType& map) { m_memoryInstrumentation->addInstrumentedMapValues(map, m_objectType); }
     template<typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); }
     void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
+    void addPrivateBuffer(size_t size) { m_memoryInstrumentation->countObjectSize(m_objectType, size); }
 
     void addWeakPointer(void*) { }
 

Modified: trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h (129874 => 129875)


--- trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h	2012-09-28 11:21:38 UTC (rev 129875)
@@ -31,8 +31,7 @@
 #ifndef MemoryInstrumentationHashSet_h
 #define MemoryInstrumentationHashSet_h
 
-#include <wtf/MemoryInstrumentationHashTable.h>
-#include <wtf/text/StringHash.h>
+#include <wtf/HashSet.h>
 
 namespace WTF {
 
@@ -40,7 +39,7 @@
 void reportMemoryUsage(const HashSet<ValueArg, HashArg, TraitsArg>* const& hashSet, MemoryObjectInfo* memoryObjectInfo)
 {
     MemoryClassInfo info(memoryObjectInfo, hashSet);
-    info.addMember(hashSet->m_impl);
+    info.addPrivateBuffer(sizeof(typename HashTable<ValueArg, ValueArg, IdentityExtractor, HashArg, TraitsArg, TraitsArg>::ValueType) * hashSet->capacity());
     info.addCollectionElements(hashSet->begin(), hashSet->end());
 }
 

Deleted: trunk/Source/WTF/wtf/MemoryInstrumentationHashTable.h (129874 => 129875)


--- trunk/Source/WTF/wtf/MemoryInstrumentationHashTable.h	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationHashTable.h	2012-09-28 11:21:38 UTC (rev 129875)
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef MemoryInstrumentationHashTable_h
-#define MemoryInstrumentationHashTable_h
-
-#include <wtf/MemoryInstrumentation.h>
-
-namespace WTF {
-
-template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
-void reportMemoryUsage(const HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>* const& hashTable, MemoryObjectInfo* memoryObjectInfo)
-{
-    MemoryClassInfo info(memoryObjectInfo, hashTable);
-    info.addRawBuffer(hashTable->m_table, sizeof(typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::ValueType) * hashTable->capacity());
-}
-
-}
-
-#endif // !defined(MemoryInstrumentationHashTable_h)

Modified: trunk/Source/WebKit/chromium/ChangeLog (129874 => 129875)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-28 11:21:38 UTC (rev 129875)
@@ -1,3 +1,17 @@
+2012-09-28  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: make HashSet memory instrumentation non-intrusive
+        https://bugs.webkit.org/show_bug.cgi?id=97879
+
+        Reviewed by Vsevolod Vlasov.
+
+        Update the test for HashSet memory instrumentation. We don't add
+        HashSet's private objects into the set of visited objects any more
+        and should update the expectation accordingly.
+
+        * tests/MemoryInstrumentationTest.cpp:
+        (WebCore::TEST):
+
 2012-09-27  Kent Tamura  <[email protected]>
 
         Use Localizer in PagePopupController

Modified: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (129874 => 129875)


--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-09-28 11:15:01 UTC (rev 129874)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-09-28 11:21:38 UTC (rev 129875)
@@ -447,7 +447,7 @@
     InstrumentedOwner<ValueType* > root(value.get());
     helper.addRootObject(root);
     EXPECT_EQ(sizeof(ValueType) + sizeof(String) * value->capacity() + sizeof(StringImpl) * value->size(), helper.reportedSizeForAllTypes());
-    EXPECT_EQ(count + 2, (size_t)helper.visitedObjects());
+    EXPECT_EQ(count + 1, (size_t)helper.visitedObjects());
 }
 
 TEST(MemoryInstrumentationTest, arrayBuffer)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to