Title: [181537] releases/WebKitGTK/webkit-2.8/Source/WebCore
Revision
181537
Author
carlo...@webkit.org
Date
2015-03-16 03:41:58 -0700 (Mon, 16 Mar 2015)

Log Message

Users of Heap::deprecatedReportExtraMemory should switch to reportExtraMemoryAllocated+reportExtraMemoryVisited
https://bugs.webkit.org/show_bug.cgi?id=142595

Reviewed by Andreas Kling.

Fixed this bug for canvas.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::memoryCost): Factored out the helper function
required by our IDL generator.

(WebCore::HTMLCanvasElement::createImageBuffer): Use
reportExtraMemoryAllocated.

* html/HTMLCanvasElement.h:

* html/HTMLCanvasElement.idl: Adopt the IDL for reporting cost in the
right way during GC. This will match our reportExtraMemoryAllocated
with a reportExtraMemoryVisited during GC.

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (181536 => 181537)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-03-16 10:30:51 UTC (rev 181536)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog	2015-03-16 10:41:58 UTC (rev 181537)
@@ -1,3 +1,25 @@
+2015-03-11  Geoffrey Garen  <gga...@apple.com>
+
+        Users of Heap::deprecatedReportExtraMemory should switch to reportExtraMemoryAllocated+reportExtraMemoryVisited
+        https://bugs.webkit.org/show_bug.cgi?id=142595
+
+        Reviewed by Andreas Kling.
+
+        Fixed this bug for canvas.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::memoryCost): Factored out the helper function
+        required by our IDL generator.
+
+        (WebCore::HTMLCanvasElement::createImageBuffer): Use
+        reportExtraMemoryAllocated.
+
+        * html/HTMLCanvasElement.h:
+
+        * html/HTMLCanvasElement.idl: Adopt the IDL for reporting cost in the
+        right way during GC. This will match our reportExtraMemoryAllocated
+        with a reportExtraMemoryVisited during GC.
+
 2015-03-11  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r179340 and r179344.

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.cpp (181536 => 181537)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.cpp	2015-03-16 10:30:51 UTC (rev 181536)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.cpp	2015-03-16 10:41:58 UTC (rev 181537)
@@ -542,6 +542,13 @@
 #endif
 }
 
+size_t HTMLCanvasElement::memoryCost() const
+{
+    if (!m_imageBuffer)
+        return 0;
+    return 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
+}
+
 void HTMLCanvasElement::createImageBuffer() const
 {
     ASSERT(!m_imageBuffer);
@@ -579,10 +586,7 @@
     m_contextStateSaver = std::make_unique<GraphicsContextStateSaver>(*m_imageBuffer->context());
 
     JSC::JSLockHolder lock(scriptExecutionContext()->vm());
-    size_t numBytes = 4 * m_imageBuffer->internalSize().width() * m_imageBuffer->internalSize().height();
-    // FIXME: Adopt reportExtraMemoryVisited, and switch to reportExtraMemoryAllocated.
-    // https://bugs.webkit.org/show_bug.cgi?id=142595
-    scriptExecutionContext()->vm().heap.deprecatedReportExtraMemory(numBytes);
+    scriptExecutionContext()->vm().heap.reportExtraMemoryAllocated(memoryCost());
 
 #if USE(IOSURFACE_CANVAS_BACKING_STORE) || ENABLE(ACCELERATED_2D_CANVAS)
     if (m_context && m_context->is2d())

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.h (181536 => 181537)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.h	2015-03-16 10:30:51 UTC (rev 181536)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.h	2015-03-16 10:41:58 UTC (rev 181537)
@@ -135,6 +135,8 @@
 
     bool shouldAccelerate(const IntSize&) const;
 
+    size_t memoryCost() const;
+
 private:
     HTMLCanvasElement(const QualifiedName&, Document&);
 

Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.idl (181536 => 181537)


--- releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.idl	2015-03-16 10:30:51 UTC (rev 181536)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/html/HTMLCanvasElement.idl	2015-03-16 10:41:58 UTC (rev 181537)
@@ -26,6 +26,7 @@
 
 [
     JSGenerateToNativeObject,
+    ReportExtraMemoryCost
 ] interface HTMLCanvasElement : HTMLElement {
 
     attribute long width;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to