Diff
Modified: trunk/Source/WTF/ChangeLog (130252 => 130253)
--- trunk/Source/WTF/ChangeLog 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/ChangeLog 2012-10-03 06:15:23 UTC (rev 130253)
@@ -1,3 +1,32 @@
+2012-10-02 Yury Semikhatsky <yu...@chromium.org>
+
+ Provide memory instrumentation for HashCountedSet
+ https://bugs.webkit.org/show_bug.cgi?id=98138
+
+ Reviewed by Pavel Feldman.
+
+ Added memory instrumentation for HashCountedSet.
+
+ Extracted common routines for collecting memory info for an iterable sequence.
+
+ * GNUmakefile.list.am:
+ * WTF.gypi:
+ * WTF.pro:
+ * WTF.vcproj/WTF.vcproj:
+ * WTF.xcodeproj/project.pbxproj:
+ * wtf/MemoryInstrumentation.h:
+ (WTF):
+ * wtf/MemoryInstrumentationHashCountedSet.h: Copied from Source/WTF/wtf/MemoryInstrumentationHashSet.h.
+ (WTF):
+ (WTF::reportMemoryUsage):
+ * wtf/MemoryInstrumentationHashMap.h:
+ (WTF::reportMemoryUsage):
+ * wtf/MemoryInstrumentationHashSet.h:
+ * wtf/MemoryInstrumentationSequence.h: Copied from Source/WTF/wtf/MemoryInstrumentationHashMap.h.
+ (WTF):
+ (WTF::SequenceMemoryInstrumentationTraits::reportMemoryUsage):
+ (WTF::reportSequenceMemoryUsage):
+
2012-10-02 Joshua Bell <jsb...@chromium.org>
Add htons/htonl definitions and implementations
Modified: trunk/Source/WTF/GNUmakefile.list.am (130252 => 130253)
--- trunk/Source/WTF/GNUmakefile.list.am 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/GNUmakefile.list.am 2012-10-03 06:15:23 UTC (rev 130253)
@@ -82,9 +82,11 @@
Source/WTF/wtf/MediaTime.cpp \
Source/WTF/wtf/MemoryInstrumentation.h \
Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h \
+ Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h \
Source/WTF/wtf/MemoryInstrumentationHashMap.h \
Source/WTF/wtf/MemoryInstrumentationHashSet.h \
Source/WTF/wtf/MemoryInstrumentationParsedURL.h \
+ Source/WTF/wtf/MemoryInstrumentationSequence.h \
Source/WTF/wtf/MemoryInstrumentationString.h \
Source/WTF/wtf/MemoryInstrumentationVector.h \
Source/WTF/wtf/MessageQueue.h \
Modified: trunk/Source/WTF/WTF.gypi (130252 => 130253)
--- trunk/Source/WTF/WTF.gypi 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/WTF.gypi 2012-10-03 06:15:23 UTC (rev 130253)
@@ -52,9 +52,11 @@
'wtf/MathExtras.h',
'wtf/MemoryInstrumentation.h',
'wtf/MemoryInstrumentationArrayBufferView.h',
+ 'wtf/MemoryInstrumentationHashCountedSet.h',
'wtf/MemoryInstrumentationHashMap.h',
'wtf/MemoryInstrumentationHashSet.h',
'wtf/MemoryInstrumentationParsedURL.h',
+ 'wtf/MemoryInstrumentationSequence.h',
'wtf/MemoryInstrumentationString.h',
'wtf/MemoryInstrumentationVector.h',
'wtf/MessageQueue.h',
Modified: trunk/Source/WTF/WTF.pro (130252 => 130253)
--- trunk/Source/WTF/WTF.pro 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/WTF.pro 2012-10-03 06:15:23 UTC (rev 130253)
@@ -89,9 +89,11 @@
MediaTime.h \
MemoryInstrumentation.h \
MemoryInstrumentationArrayBufferView.h \
+ MemoryInstrumentationHashCountedSet.h \
MemoryInstrumentationHashMap.h \
MemoryInstrumentationHashSet.h \
MemoryInstrumentationParsedURL.h \
+ MemoryInstrumentationSequence.h \
MemoryInstrumentationString.h \
MemoryInstrumentationVector.h \
MessageQueue.h \
Modified: trunk/Source/WTF/WTF.vcproj/WTF.vcproj (130252 => 130253)
--- trunk/Source/WTF/WTF.vcproj/WTF.vcproj 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/WTF.vcproj/WTF.vcproj 2012-10-03 06:15:23 UTC (rev 130253)
@@ -913,6 +913,10 @@
>
</File>
<File
+ RelativePath="..\wtf\MemoryInstrumentationHashCountedSet.h"
+ >
+ </File>
+ <File
RelativePath="..\wtf\MemoryInstrumentationHashMap.h"
>
</File>
@@ -921,6 +925,10 @@
>
</File>
<File
+ RelativePath="..\wtf\MemoryInstrumentationSequence.h"
+ >
+ </File>
+ <File
RelativePath="..\wtf\MemoryInstrumentationString.h"
>
</File>
Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (130252 => 130253)
--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj 2012-10-03 06:15:23 UTC (rev 130253)
@@ -279,6 +279,8 @@
CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5497AB15857D0300B5BC30 /* MediaTime.h */; };
F3525E461619A4EE00278BC1 /* MemoryInstrumentationHashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */; };
+ F3FBC71E161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */; };
+ F3FBC720161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -563,6 +565,8 @@
CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; };
F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashMap.h; sourceTree = "<group>"; };
+ F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashCountedSet.h; sourceTree = "<group>"; };
+ F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationSequence.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -706,9 +710,11 @@
CD5497AB15857D0300B5BC30 /* MediaTime.h */,
4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */,
4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */,
+ F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */,
F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */,
4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */,
4FD2A358161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h */,
+ F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */,
4FCF27E016172E8600CBF037 /* MemoryInstrumentationString.h */,
4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */,
A8A472CC151A825B004123FF /* MessageQueue.h */,
@@ -1169,6 +1175,8 @@
F3525E461619A4EE00278BC1 /* MemoryInstrumentationHashMap.h in Headers */,
4FCF27E116172E8600CBF037 /* MemoryInstrumentationString.h in Headers */,
4FD2A359161B0EE100EBF236 /* MemoryInstrumentationParsedURL.h in Headers */,
+ F3FBC71E161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h in Headers */,
+ F3FBC720161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (130252 => 130253)
--- trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-10-03 06:15:23 UTC (rev 130253)
@@ -314,6 +314,9 @@
template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> class HashMap;
template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg> void reportMemoryUsage(const HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>* const&, MemoryObjectInfo*);
+template<typename ValueArg, typename HashArg, typename TraitsArg> class HashCountedSet;
+template<typename ValueArg, typename HashArg, typename TraitsArg> void reportMemoryUsage(const HashCountedSet<ValueArg, HashArg, TraitsArg>* const&, MemoryObjectInfo*);
+
class String;
void reportMemoryUsage(const String* const&, MemoryObjectInfo*);
Copied: trunk/Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h (from rev 130252, trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h) (0 => 130253)
--- trunk/Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h (rev 0)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h 2012-10-03 06:15:23 UTC (rev 130253)
@@ -0,0 +1,51 @@
+/*
+ * 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 MemoryInstrumentationHashCountedSet_h
+#define MemoryInstrumentationHashCountedSet_h
+
+#include <wtf/HashCountedSet.h>
+#include <wtf/MemoryInstrumentationSequence.h>
+
+namespace WTF {
+
+template<typename ValueArg, typename HashArg, typename TraitsArg>
+void reportMemoryUsage(const HashCountedSet<ValueArg, HashArg, TraitsArg>* const& hashSet, MemoryObjectInfo* memoryObjectInfo)
+{
+ MemoryClassInfo info(memoryObjectInfo, hashSet);
+
+ typedef HashMap<ValueArg, unsigned, HashArg, TraitsArg> HashMapType;
+ info.addPrivateBuffer(sizeof(typename HashMapType::ValueType) * hashSet->capacity());
+ reportSequenceMemoryUsage<ValueArg, typename HashMapType::const_iterator::Keys>(hashSet->begin().keys(), hashSet->end().keys(), info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationHashCountedSet_h)
Modified: trunk/Source/WTF/wtf/MemoryInstrumentationHashMap.h (130252 => 130253)
--- trunk/Source/WTF/wtf/MemoryInstrumentationHashMap.h 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationHashMap.h 2012-10-03 06:15:23 UTC (rev 130253)
@@ -32,40 +32,19 @@
#define MemoryInstrumentationHashMap_h
#include <wtf/HashMap.h>
-#include <wtf/TypeTraits.h>
+#include <wtf/MemoryInstrumentationSequence.h>
namespace WTF {
-template<typename KeyType>
-struct SequenceMemoryInstrumentationTraits {
- template <typename I> static void reportMemoryUsage(I iterator, I end, MemoryClassInfo& info)
- {
- info.addCollectionElements(iterator, end);
- }
-};
-
-template<> struct SequenceMemoryInstrumentationTraits<int> {
- template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
-};
-
-template<> struct SequenceMemoryInstrumentationTraits<void*> {
- template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
-};
-
template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTraitsArg, typename MappedTraitsArg>
void reportMemoryUsage(const HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg>* const& hashMap, MemoryObjectInfo* memoryObjectInfo)
{
MemoryClassInfo info(memoryObjectInfo, hashMap);
typedef HashMap<KeyArg, MappedArg, HashArg, KeyTraitsArg, MappedTraitsArg> HashMapType;
+ info.addPrivateBuffer(sizeof(typename HashMapType::ValueType) * hashMap->capacity());
- typedef HashMapValueTraits<KeyArg, MappedArg> ValueTraits;
- typedef HashTable<typename HashMapType::KeyType, typename HashMapType::ValueType, KeyValuePairKeyExtractor<typename HashMapType::ValueType>, HashArg, ValueTraits, KeyTraitsArg> HashTableType;
-
- info.addPrivateBuffer(sizeof(typename HashTableType::ValueType) * hashMap->capacity());
-
- // Check if type is convertible to integer to handle enum keys and values.
- SequenceMemoryInstrumentationTraits<typename Conditional<IsConvertibleToInteger<KeyArg>::value, int, KeyArg>::Type>::reportMemoryUsage(hashMap->begin().keys(), hashMap->end().keys(), info);
- SequenceMemoryInstrumentationTraits<typename Conditional<IsConvertibleToInteger<MappedArg>::value, int, MappedArg>::Type>::reportMemoryUsage(hashMap->begin().values(), hashMap->end().values(), info);
+ reportSequenceMemoryUsage<KeyArg, typename HashMapType::const_iterator::Keys>(hashMap->begin().keys(), hashMap->end().keys(), info);
+ reportSequenceMemoryUsage<MappedArg, typename HashMapType::const_iterator::Values>(hashMap->begin().values(), hashMap->end().values(), info);
}
}
Modified: trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h (130252 => 130253)
--- trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h 2012-10-03 06:15:23 UTC (rev 130253)
@@ -32,6 +32,7 @@
#define MemoryInstrumentationHashSet_h
#include <wtf/HashSet.h>
+#include <wtf/MemoryInstrumentation.h>
namespace WTF {
Copied: trunk/Source/WTF/wtf/MemoryInstrumentationSequence.h (from rev 130252, trunk/Source/WTF/wtf/MemoryInstrumentationHashMap.h) (0 => 130253)
--- trunk/Source/WTF/wtf/MemoryInstrumentationSequence.h (rev 0)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationSequence.h 2012-10-03 06:15:23 UTC (rev 130253)
@@ -0,0 +1,63 @@
+/*
+ * 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 MemoryInstrumentationSequence_h
+#define MemoryInstrumentationSequence_h
+
+#include <wtf/MemoryInstrumentation.h>
+#include <wtf/TypeTraits.h>
+
+namespace WTF {
+
+template<typename ValueType>
+struct SequenceMemoryInstrumentationTraits {
+ template <typename I> static void reportMemoryUsage(I iterator, I end, MemoryClassInfo& info)
+ {
+ info.addCollectionElements(iterator, end);
+ }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<int> {
+ template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<> struct SequenceMemoryInstrumentationTraits<void*> {
+ template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
+template<typename ValueType, typename I> void reportSequenceMemoryUsage(I begin, I end, MemoryClassInfo& info)
+{
+ // Check if type is convertible to integer to handle iteration through enum values.
+ SequenceMemoryInstrumentationTraits<typename Conditional<IsConvertibleToInteger<ValueType>::value, int, ValueType>::Type>::reportMemoryUsage(begin, end, info);
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationSequence_h)
Modified: trunk/Source/WebCore/ChangeLog (130252 => 130253)
--- trunk/Source/WebCore/ChangeLog 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WebCore/ChangeLog 2012-10-03 06:15:23 UTC (rev 130253)
@@ -1,3 +1,17 @@
+2012-10-02 Yury Semikhatsky <yu...@chromium.org>
+
+ Provide memory instrumentation for HashCountedSet
+ https://bugs.webkit.org/show_bug.cgi?id=98138
+
+ Reviewed by Pavel Feldman.
+
+ Replaced addHashCountedSet calls with addMember that now automatically
+ detects HashCountedSet and calls appropriate routine.
+
+ * css/CSSImageGeneratorValue.cpp:
+ (WebCore::CSSImageGeneratorValue::reportBaseClassMemoryUsage):
+ * loader/cache/CachedResource.cpp:
+
2012-10-02 Nandor Huszka <hnan...@inf.u-szeged.hu>
Buildfix after r130235.
Modified: trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp (130252 => 130253)
--- trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WebCore/css/CSSImageGeneratorValue.cpp 2012-10-03 06:15:23 UTC (rev 130253)
@@ -32,6 +32,7 @@
#include "Image.h"
#include "RenderObject.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationHashCountedSet.h>
#include <wtf/MemoryInstrumentationHashMap.h>
#include <wtf/text/WTFString.h>
@@ -113,7 +114,7 @@
void CSSImageGeneratorValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addHashCountedSet(m_sizes);
+ info.addMember(m_sizes);
info.addMember(m_clients);
info.addMember(m_images); // FIXME: instrument Image
}
Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (130252 => 130253)
--- trunk/Source/WebCore/loader/cache/CachedResource.cpp 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp 2012-10-03 06:15:23 UTC (rev 130253)
@@ -44,6 +44,7 @@
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/CurrentTime.h>
#include <wtf/MathExtras.h>
+#include <wtf/MemoryInstrumentationHashCountedSet.h>
#include <wtf/MemoryInstrumentationHashSet.h>
#include <wtf/RefCountedLeakCounter.h>
#include <wtf/StdLibExtras.h>
Modified: trunk/Source/WebKit/chromium/ChangeLog (130252 => 130253)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-10-03 06:15:23 UTC (rev 130253)
@@ -1,3 +1,14 @@
+2012-10-02 Yury Semikhatsky <yu...@chromium.org>
+
+ Provide memory instrumentation for HashCountedSet
+ https://bugs.webkit.org/show_bug.cgi?id=98138
+
+ Reviewed by Pavel Feldman.
+
+ Added unit test for HashCountedSet memory instrumentation.
+
+ * tests/MemoryInstrumentationTest.cpp:
+
2012-10-02 Kent Tamura <tk...@chromium.org>
[Chromium-Win] Implement LocaleWin::dateFormat
Modified: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (130252 => 130253)
--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp 2012-10-03 06:04:25 UTC (rev 130252)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp 2012-10-03 06:15:23 UTC (rev 130253)
@@ -37,9 +37,11 @@
#include <gtest/gtest.h>
#include <wtf/ArrayBuffer.h>
+#include <wtf/HashCountedSet.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
#include <wtf/MemoryInstrumentationArrayBufferView.h>
+#include <wtf/MemoryInstrumentationHashCountedSet.h>
#include <wtf/MemoryInstrumentationHashMap.h>
#include <wtf/MemoryInstrumentationHashSet.h>
#include <wtf/MemoryInstrumentationString.h>
@@ -653,6 +655,25 @@
EXPECT_EQ(count + 1, helper.visitedObjects());
}
+TEST(MemoryInstrumentationTest, hashCountedSetWithInstrumentedValues)
+{
+ InstrumentationTestHelper helper;
+
+ typedef HashCountedSet<Instrumented*> TestSet;
+ OwnPtr<TestSet> set = adoptPtr(new TestSet());
+ Vector<OwnPtr<Instrumented> > keysVector;
+ int count = 10;
+ for (int i = 0; i < count; ++i) {
+ keysVector.append(adoptPtr(new Instrumented()));
+ for (int j = 0; j <= i; j++)
+ set->add(keysVector.last().get());
+ }
+ InstrumentedOwner<TestSet* > root(set.get());
+ helper.addRootObject(root);
+ EXPECT_EQ(sizeof(TestSet) + sizeof(HashMap<Instrumented*, unsigned>::ValueType) * set->capacity() + (sizeof(Instrumented) + sizeof(NotInstrumented)) * set->size(), helper.reportedSizeForAllTypes());
+ EXPECT_EQ(2 * count + 1, helper.visitedObjects());
+}
+
TEST(MemoryInstrumentationTest, arrayBuffer)
{
InstrumentationTestHelper helper;