Modified: trunk/Source/WTF/ChangeLog (137892 => 137893)
--- trunk/Source/WTF/ChangeLog 2012-12-17 11:29:39 UTC (rev 137892)
+++ trunk/Source/WTF/ChangeLog 2012-12-17 11:35:31 UTC (rev 137893)
@@ -1,3 +1,17 @@
+2012-12-17 Ilya Tikhonovsky <loi...@chromium.org>
+
+ Unreviewed, rolling out r137892.
+ http://trac.webkit.org/changeset/137892
+ https://bugs.webkit.org/show_bug.cgi?id=105026
+
+ it broke compilation on windows
+
+ * wtf/MemoryInstrumentation.h:
+ (WTF::MemoryInstrumentation::selectInstrumentationMethod):
+ (MemoryInstrumentation):
+ (WTF::MemoryInstrumentation::reportObjectMemoryUsage):
+ (WTF::reportMemoryUsage):
+
2012-12-14 Ilya Tikhonovsky <loi...@chromium.org>
Web Inspector: Native Memory Instrumentation: MemoryInstrumentation doesn't detect reportMemoryUsage method defined in a base class.
Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (137892 => 137893)
--- trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-12-17 11:29:39 UTC (rev 137892)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-12-17 11:35:31 UTC (rev 137893)
@@ -116,36 +116,25 @@
friend class MemoryClassInfo;
template<typename T> friend void reportMemoryUsage(const T*, MemoryObjectInfo*);
- template <typename Type>
- class IsInstrumented {
- class yes {
- char m;
- };
+ template<typename T> static void selectInstrumentationMethod(const T* object, MemoryObjectInfo* memoryObjectInfo)
+ {
+ // If there is reportMemoryUsage method on the object, call it.
+ // Otherwise count only object's self size.
+ reportObjectMemoryUsage<T, void (T::*)(MemoryObjectInfo*) const>(object, memoryObjectInfo, 0);
+ }
- class no {
- yes m[2];
- };
+ template<typename Type, Type Ptr> struct MemberHelperStruct;
+ template<typename T, typename Type>
+ static void reportObjectMemoryUsage(const T* object, MemoryObjectInfo* memoryObjectInfo, MemberHelperStruct<Type, &T::reportMemoryUsage>*)
+ {
+ object->reportMemoryUsage(memoryObjectInfo);
+ }
- struct Mixin {
- void reportMemoryUsage(MemoryObjectInfo*) const { }
- };
-
- struct Derived : public Type, public Mixin { };
- template <typename T, T t> class Helper { };
-
- template <typename U> static no deduce(U*, Helper<void (Mixin::*)(MemoryObjectInfo*) const, &U::reportMemoryUsage>* = 0);
- static yes deduce(...);
-
- public:
- static const bool result = sizeof(yes) == sizeof(deduce((Derived*)(0)));
-
- };
-
- template <bool>
- struct InstrumentationSelector {
- template <typename T> static void reportObjectMemoryUsage(const T*, MemoryObjectInfo*);
- };
-
+ template<typename T, typename Type>
+ static void reportObjectMemoryUsage(const T* object, MemoryObjectInfo* memoryObjectInfo, ...)
+ {
+ callReportObjectInfo(memoryObjectInfo, object, 0, sizeof(T));
+ }
WTF_EXPORT_PRIVATE static void callReportObjectInfo(MemoryObjectInfo*, const void* pointer, MemoryObjectType, size_t objectSize);
template<typename T> class Wrapper : public WrapperBase {
@@ -200,20 +189,6 @@
MemoryInstrumentationClient* m_client;
};
-template <>
-template <typename T>
-void MemoryInstrumentation::InstrumentationSelector<true>::reportObjectMemoryUsage(const T* object, MemoryObjectInfo* memoryObjectInfo)
-{
- object->reportMemoryUsage(memoryObjectInfo);
-}
-
-template <>
-template <typename T>
-void MemoryInstrumentation::InstrumentationSelector<false>::reportObjectMemoryUsage(const T* object, MemoryObjectInfo* memoryObjectInfo)
-{
- callReportObjectInfo(memoryObjectInfo, object, 0, sizeof(T));
-}
-
class MemoryClassInfo {
public:
template<typename T>
@@ -249,7 +224,7 @@
template<typename T>
void reportMemoryUsage(const T* object, MemoryObjectInfo* memoryObjectInfo)
{
- MemoryInstrumentation::InstrumentationSelector<MemoryInstrumentation::IsInstrumented<T>::result>::reportObjectMemoryUsage(object, memoryObjectInfo);
+ MemoryInstrumentation::selectInstrumentationMethod<T>(object, memoryObjectInfo);
}
template<typename T>
Modified: trunk/Tools/ChangeLog (137892 => 137893)
--- trunk/Tools/ChangeLog 2012-12-17 11:29:39 UTC (rev 137892)
+++ trunk/Tools/ChangeLog 2012-12-17 11:35:31 UTC (rev 137893)
@@ -1,3 +1,13 @@
+2012-12-17 Ilya Tikhonovsky <loi...@chromium.org>
+
+ Unreviewed, rolling out r137892.
+ http://trac.webkit.org/changeset/137892
+ https://bugs.webkit.org/show_bug.cgi?id=105026
+
+ it broke compilation on windows
+
+ * TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:
+
2012-12-14 Ilya Tikhonovsky <loi...@chromium.org>
Web Inspector: Native Memory Instrumentation: MemoryInstrumentation doesn't detect reportMemoryUsage method defined in a base class.
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp (137892 => 137893)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp 2012-12-17 11:29:39 UTC (rev 137892)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp 2012-12-17 11:35:31 UTC (rev 137893)
@@ -872,21 +872,5 @@
instrumentation.addRootObject(instance.get());
EXPECT_EQ(1, client.linkCount());
}
-
-class DerivedClass : public Instrumented {
-public:
- size_t m_member;
-};
-
-TEST(MemoryInstrumentationTest, detectBaseClassInstrumentation)
-{
- OwnPtr<DerivedClass> instance = adoptPtr(new DerivedClass());
-
- InstrumentationTestHelper helper;
- helper.addRootObject(instance.get(), TestType);
- EXPECT_EQ(sizeof(Instrumented) + sizeof(NotInstrumented), helper.reportedSizeForAllTypes());
- EXPECT_EQ(2u, helper.visitedObjects());
-}
-
} // namespace