Title: [128283] trunk/Source
Revision
128283
Author
yu...@chromium.org
Date
2012-09-12 02:45:04 -0700 (Wed, 12 Sep 2012)

Log Message

Web Inspector: Persistent handle referenced from ScriptWrappable is double counted
https://bugs.webkit.org/show_bug.cgi?id=96483

Reviewed by Alexander Pavlov.

Source/WebCore:

* bindings/v8/ScriptWrappable.h:
(WebCore::ScriptWrappable::reportMemoryUsage): the handle is a part of an
array where all such handles are allocated and should not be counted here
second time. In order to make the clang plugin that validate memory instrumentation
happy we report it here as weak pointer (no-op).

Source/WTF:

* wtf/MemoryInstrumentation.h:
(WebCore::MemoryClassInfo::addWeakPointer): this method is expected to be
used on fields that are pointers to objects which are parts of bigger memory
blocks (field of another object, element in an array, object allocated in a
memory arena etc.). We don't want to count such objects' memory separately
from their owners but in order to be able to validates the memory instrumentation
with clang plugin we need to make sure all fields in instrumented objects
are reported.
(MemoryClassInfo):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (128282 => 128283)


--- trunk/Source/WTF/ChangeLog	2012-09-12 09:38:58 UTC (rev 128282)
+++ trunk/Source/WTF/ChangeLog	2012-09-12 09:45:04 UTC (rev 128283)
@@ -1,3 +1,20 @@
+2012-09-12  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: Persistent handle referenced from ScriptWrappable is double counted
+        https://bugs.webkit.org/show_bug.cgi?id=96483
+
+        Reviewed by Alexander Pavlov.
+
+        * wtf/MemoryInstrumentation.h:
+        (WebCore::MemoryClassInfo::addWeakPointer): this method is expected to be
+        used on fields that are pointers to objects which are parts of bigger memory
+        blocks (field of another object, element in an array, object allocated in a
+        memory arena etc.). We don't want to count such objects' memory separately
+        from their owners but in order to be able to validates the memory instrumentation
+        with clang plugin we need to make sure all fields in instrumented objects
+        are reported.
+        (MemoryClassInfo):
+
 2012-09-12  Ilya Tikhonovsky  <loi...@chromium.org>
 
         Web Inspector: NMI move String* instrumentation to wtf.

Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (128282 => 128283)


--- trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-09-12 09:38:58 UTC (rev 128282)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h	2012-09-12 09:45:04 UTC (rev 128283)
@@ -217,6 +217,8 @@
     template<typename VectorType> void addVectorPtr(const VectorType* const vector) { m_memoryInstrumentation->addVector(*vector, m_objectType, false); }
     void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
 
+    void addWeakPointer(void*) { }
+
 private:
     MemoryObjectInfo* m_memoryObjectInfo;
     MemoryInstrumentation* m_memoryInstrumentation;

Modified: trunk/Source/WebCore/ChangeLog (128282 => 128283)


--- trunk/Source/WebCore/ChangeLog	2012-09-12 09:38:58 UTC (rev 128282)
+++ trunk/Source/WebCore/ChangeLog	2012-09-12 09:45:04 UTC (rev 128283)
@@ -1,3 +1,16 @@
+2012-09-12  Yury Semikhatsky  <yu...@chromium.org>
+
+        Web Inspector: Persistent handle referenced from ScriptWrappable is double counted
+        https://bugs.webkit.org/show_bug.cgi?id=96483
+
+        Reviewed by Alexander Pavlov.
+
+        * bindings/v8/ScriptWrappable.h:
+        (WebCore::ScriptWrappable::reportMemoryUsage): the handle is a part of an
+        array where all such handles are allocated and should not be counted here
+        second time. In order to make the clang plugin that validate memory instrumentation
+        happy we report it here as weak pointer (no-op).
+
 2012-09-12  Eugene Klyuchnikov  <eustas....@gmail.com>
 
         Web Inspector: Implement search and filtering on Timeline panel

Modified: trunk/Source/WebCore/bindings/v8/ScriptWrappable.h (128282 => 128283)


--- trunk/Source/WebCore/bindings/v8/ScriptWrappable.h	2012-09-12 09:38:58 UTC (rev 128282)
+++ trunk/Source/WebCore/bindings/v8/ScriptWrappable.h	2012-09-12 09:45:04 UTC (rev 128283)
@@ -56,7 +56,7 @@
     void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
         MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
-        info.addMember(m_wrapper);
+        info.addWeakPointer(m_wrapper);
     }
 
 private:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to