Title: [181415] trunk/Source/WebCore
Revision
181415
Author
[email protected]
Date
2015-03-11 17:15:21 -0700 (Wed, 11 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: trunk/Source/WebCore/ChangeLog (181414 => 181415)


--- trunk/Source/WebCore/ChangeLog	2015-03-11 23:52:45 UTC (rev 181414)
+++ trunk/Source/WebCore/ChangeLog	2015-03-12 00:15:21 UTC (rev 181415)
@@ -1,3 +1,25 @@
+2015-03-11  Geoffrey Garen  <[email protected]>
+
+        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  Roger Fong  <[email protected]>
 
         A number of minor edits to the media controls on OSX.

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (181414 => 181415)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2015-03-11 23:52:45 UTC (rev 181414)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2015-03-12 00:15:21 UTC (rev 181415)
@@ -538,6 +538,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);
@@ -575,10 +582,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: trunk/Source/WebCore/html/HTMLCanvasElement.h (181414 => 181415)


--- trunk/Source/WebCore/html/HTMLCanvasElement.h	2015-03-11 23:52:45 UTC (rev 181414)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h	2015-03-12 00:15:21 UTC (rev 181415)
@@ -135,6 +135,8 @@
 
     bool shouldAccelerate(const IntSize&) const;
 
+    size_t memoryCost() const;
+
 private:
     HTMLCanvasElement(const QualifiedName&, Document&);
 

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.idl (181414 => 181415)


--- trunk/Source/WebCore/html/HTMLCanvasElement.idl	2015-03-11 23:52:45 UTC (rev 181414)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.idl	2015-03-12 00:15:21 UTC (rev 181415)
@@ -26,6 +26,7 @@
 
 [
     JSGenerateToNativeObject,
+    ReportExtraMemoryCost
 ] interface HTMLCanvasElement : HTMLElement {
 
     attribute long width;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to