Title: [127856] trunk/Source/WebCore
Revision
127856
Author
loi...@chromium.org
Date
2012-09-07 05:10:22 -0700 (Fri, 07 Sep 2012)

Log Message

Web Inspector: NMI: remove DataRef instrumentation from the core NMI code.
https://bugs.webkit.org/show_bug.cgi?id=96086

Reviewed by Yury Semikhatsky.

This patch is removing the last WebCore specific methods from core memory instrumentation code.

It is covered by webkit_unit_tests.

* dom/MemoryInstrumentation.h:
(WebCore):
(MemoryObjectInfo):
(WebCore::MemoryClassInfo::MemoryClassInfo):
* rendering/style/DataRef.h:
(DataRef):
(WebCore::DataRef::reportMemoryUsage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (127855 => 127856)


--- trunk/Source/WebCore/ChangeLog	2012-09-07 12:05:30 UTC (rev 127855)
+++ trunk/Source/WebCore/ChangeLog	2012-09-07 12:10:22 UTC (rev 127856)
@@ -1,3 +1,22 @@
+2012-09-07  Ilya Tikhonovsky  <loi...@chromium.org>
+
+        Web Inspector: NMI: remove DataRef instrumentation from the core NMI code.
+        https://bugs.webkit.org/show_bug.cgi?id=96086
+
+        Reviewed by Yury Semikhatsky.
+
+        This patch is removing the last WebCore specific methods from core memory instrumentation code.
+
+        It is covered by webkit_unit_tests.
+
+        * dom/MemoryInstrumentation.h:
+        (WebCore):
+        (MemoryObjectInfo):
+        (WebCore::MemoryClassInfo::MemoryClassInfo):
+        * rendering/style/DataRef.h:
+        (DataRef):
+        (WebCore::DataRef::reportMemoryUsage):
+
 2012-09-06  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Migrate IndexedDB to async protocol commands.

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (127855 => 127856)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-09-07 12:05:30 UTC (rev 127855)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-09-07 12:10:22 UTC (rev 127856)
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (C) 2012 Google Inc. All rights reserved.
  *
@@ -40,8 +39,8 @@
 
 namespace WebCore {
 
-template<typename T> class DataRef;
 class KURL;
+class MemoryClassInfo;
 class MemoryObjectInfo;
 class MemoryInstrumentation;
 
@@ -146,12 +145,10 @@
     };
 
     template<typename T> void addInstrumentedObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType);
-    template<typename T> void addInstrumentedObjectImpl(const DataRef<T>* const&, MemoryObjectType, MemoryOwningType);
     template<typename T> void addInstrumentedObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType);
     template<typename T> void addInstrumentedObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType);
 
     template<typename T> void addObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType);
-    template<typename T> void addObjectImpl(const DataRef<T>* const&, MemoryObjectType, MemoryOwningType);
     template<typename T> void addObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType);
     template<typename T> void addObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType);
 };
@@ -176,6 +173,8 @@
         , m_objectSize(0)
     { }
 
+    typedef MemoryClassInfo ClassInfo;
+
     MemoryObjectType objectType() const { return m_objectType; }
     size_t objectSize() const { return m_objectSize; }
 
@@ -201,7 +200,7 @@
 class MemoryClassInfo {
 public:
     template<typename T>
-    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryObjectType objectType, size_t actualSize = 0)
+    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryObjectType objectType = 0, size_t actualSize = 0)
         : m_memoryObjectInfo(memoryObjectInfo)
         , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
     {
@@ -246,14 +245,6 @@
 }
 
 template<typename T>
-void MemoryInstrumentation::addInstrumentedObjectImpl(const DataRef<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
-{
-    if (owningType == byPointer)
-        countObjectSize(ownerObjectType, sizeof(*object));
-    addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer);
-}
-
-template<typename T>
 void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
 {
     if (owningType == byPointer)
@@ -270,14 +261,6 @@
 }
 
 template<typename T>
-void MemoryInstrumentation::addObjectImpl(const DataRef<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
-{
-    if (owningType == byPointer)
-        countObjectSize(ownerObjectType, sizeof(*object));
-    addObjectImpl(object->get(), ownerObjectType, byPointer);
-}
-
-template<typename T>
 void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
 {
     if (owningType == byPointer)

Modified: trunk/Source/WebCore/rendering/style/DataRef.h (127855 => 127856)


--- trunk/Source/WebCore/rendering/style/DataRef.h	2012-09-07 12:05:30 UTC (rev 127855)
+++ trunk/Source/WebCore/rendering/style/DataRef.h	2012-09-07 12:10:22 UTC (rev 127856)
@@ -62,6 +62,14 @@
         return m_data != o.m_data && *m_data != *o.m_data;
     }
 
+    // Template helps us to write the implementation without MemoryInstrumentation.h include.
+    template<typename MemoryObjectInfo>
+    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+    {
+        typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
+        info.addInstrumentedMember(m_data);
+    }
+
 private:
     RefPtr<T> m_data;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to