Title: [123645] trunk/Source/WebKit/chromium
Revision
123645
Author
al...@chromium.org
Date
2012-07-25 12:50:22 -0700 (Wed, 25 Jul 2012)

Log Message

[chromium] WebViewBenchmarkSupport::paint API does not work with recording canvas
https://bugs.webkit.org/show_bug.cgi?id=92008

Reviewed by Darin Fisher.

Moved the ownership of canvas to WebViewBenchmarkSupport::PaintClient.

* public/WebViewBenchmarkSupport.h:
(PaintClient):
(WebKit::WebViewBenchmarkSupport::PaintClient::willPaint):
(WebKit::WebViewBenchmarkSupport::PaintClient::didPaint):
* src/WebViewBenchmarkSupportImpl.cpp:
(WebKit::WebViewBenchmarkSupportImpl::paintLayer):
(WebKit::WebViewBenchmarkSupportImpl::softwarePaint):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (123644 => 123645)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-07-25 19:46:18 UTC (rev 123644)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-07-25 19:50:22 UTC (rev 123645)
@@ -1,3 +1,20 @@
+2012-07-25  Alok Priyadarshi  <al...@chromium.org>
+
+        [chromium] WebViewBenchmarkSupport::paint API does not work with recording canvas
+        https://bugs.webkit.org/show_bug.cgi?id=92008
+
+        Reviewed by Darin Fisher.
+
+        Moved the ownership of canvas to WebViewBenchmarkSupport::PaintClient.
+
+        * public/WebViewBenchmarkSupport.h:
+        (PaintClient):
+        (WebKit::WebViewBenchmarkSupport::PaintClient::willPaint):
+        (WebKit::WebViewBenchmarkSupport::PaintClient::didPaint):
+        * src/WebViewBenchmarkSupportImpl.cpp:
+        (WebKit::WebViewBenchmarkSupportImpl::paintLayer):
+        (WebKit::WebViewBenchmarkSupportImpl::softwarePaint):
+
 2012-07-24  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Turn the debug HUD into a layer so that it can be drawn as a WebCompositorQuad

Modified: trunk/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h (123644 => 123645)


--- trunk/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h	2012-07-25 19:46:18 UTC (rev 123644)
+++ trunk/Source/WebKit/chromium/public/WebViewBenchmarkSupport.h	2012-07-25 19:50:22 UTC (rev 123645)
@@ -51,14 +51,15 @@
     // when painting is about to occur and when painting is complete.
     class PaintClient {
     public:
-        virtual WebCanvas* createCanvas(const WebSize&) = 0;
+        // Called by the WebViewBenchmarkSupport when painting is about to occur.
+        // PaintClient is expected to return an appropriately-sized canvas
+        // for the WebViewBenchmarkSupport to paint on.
+        virtual WebCanvas* willPaint(const WebSize&) { return 0; }
 
-        // Called by the WebViewBenchmarkSupport when painting is about to
-        // occur.
-        virtual void willPaint(const WebCanvas&) { }
-
         // Called by the WebViewBenchmarkSupport when painting is complete.
-        virtual void didPaint(const WebCanvas&) { }
+        // The canvas will not be used after this call and can be destroyed
+        // if necessary.
+        virtual void didPaint(WebCanvas*) { }
     protected:
         virtual ~PaintClient() { }
     };

Modified: trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp (123644 => 123645)


--- trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp	2012-07-25 19:46:18 UTC (rev 123644)
+++ trunk/Source/WebKit/chromium/src/WebViewBenchmarkSupportImpl.cpp	2012-07-25 19:50:22 UTC (rev 123645)
@@ -47,12 +47,11 @@
 void WebViewBenchmarkSupportImpl::paintLayer(PaintClient* paintClient, GraphicsLayer& layer, const IntRect& clip)
 {
     WebSize canvasSize(clip.width(), clip.height());
-    OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize));
-    GraphicsContextBuilder builder(canvas.get());
+    WebCanvas* canvas = paintClient->willPaint(canvasSize);
+    GraphicsContextBuilder builder(canvas);
 
-    paintClient->willPaint(*canvas.get());
     layer.paintGraphicsLayerContents(builder.context(), clip);
-    paintClient->didPaint(*canvas.get());
+    paintClient->didPaint(canvas);
 }
 
 void WebViewBenchmarkSupportImpl::acceleratedPaintUnclipped(PaintClient* paintClient, GraphicsLayer& layer)
@@ -84,10 +83,9 @@
     }
 
     WebSize canvasSize(paintSize.width, paintSize.height);
-    OwnPtr<WebCanvas> canvas = adoptPtr(paintClient->createCanvas(canvasSize));
-    paintClient->willPaint(*canvas.get());
-    m_webViewImpl->paint(canvas.get(), paintSize);
-    paintClient->didPaint(*canvas.get());
+    WebCanvas* canvas = paintClient->willPaint(canvasSize);
+    m_webViewImpl->paint(canvas, paintSize);
+    paintClient->didPaint(canvas);
 }
 
 void WebViewBenchmarkSupportImpl::paint(PaintClient* paintClient, PaintMode paintMode)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to