summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-08 20:48:04 +0000
committerjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-08 20:48:04 +0000
commitef82acffb8b94957e8a65e7f72adab39398f04f8 (patch)
treee35c84e013ad13355c3c37ccdc44e2ab50c2566c /webkit
parentcdccbc64763227c16bb9fd4c3a12c16de49cd366 (diff)
downloadchromium_src-ef82acffb8b94957e8a65e7f72adab39398f04f8.zip
chromium_src-ef82acffb8b94957e8a65e7f72adab39398f04f8.tar.gz
chromium_src-ef82acffb8b94957e8a65e7f72adab39398f04f8.tar.bz2
Merge 120490 - Provide WillInitiatePaint() as well as DidInitiatePaint() and tweak semantics.
WillInitiatePaint() informs derived classes when the RenderWidget is about to perform a paint operation. DidInitiatePaint() informs derived classes that the RenderWidget has finished the paint operation and sent it to the browser to display. DidFlushPaint() informs derived classes when the paint operation has actually been displayed (either in response to UpdateRectAck, or OnSwapBuffersComplete()). Pepper Graphics2D uses WillInitiatePaint and DidFlushPaint to trigger its Flush callback only for flushes occurring after the paint has actually been initiated. Pepper Graphics3D uses DidInitiatePaint to know when the 3D pipeline is done with buffers from the previous paint operation, so that new content rendered to them won't be prematurely flushed to the screen. Known issues with this CL: * There is still scope for the Graphics2D to get confused when threaded compositing is in use, since DidFlushPaint for an older paint may be received after WillInitiatePaint for a more recent one, but that is a fix for another CL. * Graphics3D will now be notified earlier in than it would have been in the software case, since it previously hooked DidFlushPaint. BUG=111639 TEST=Run Native Client Examples "Pi generator", "Tumbler" and "Fullscreen Tumbler" with and without --force-composite-mode and verify they update correctly. Review URL: http://codereview.chromium.org/9328016 TBR=wez@chromium.org Review URL: https://chromiumcodereview.appspot.com/9360027 git-svn-id: svn://svn.chromium.org/chrome/branches/1025/src@121038 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc7
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h7
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_2d_impl.cc10
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_2d_impl.h13
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.cc9
-rw-r--r--webkit/plugins/ppapi/ppb_graphics_3d_impl.h8
6 files changed, 35 insertions, 19 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 7622a63..38c8a5d 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -809,6 +809,13 @@ void PluginInstance::PageVisibilityChanged(bool is_visible) {
SendDidChangeView(old_data);
}
+void PluginInstance::ViewWillInitiatePaint() {
+ if (GetBoundGraphics2D())
+ GetBoundGraphics2D()->ViewWillInitiatePaint();
+ else if (GetBoundGraphics3D())
+ GetBoundGraphics3D()->ViewWillInitiatePaint();
+}
+
void PluginInstance::ViewInitiatedPaint() {
if (GetBoundGraphics2D())
GetBoundGraphics2D()->ViewInitiatedPaint();
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index 1287111..0156cda 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -192,9 +192,10 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// Notification about page visibility. The default is "visible".
void PageVisibilityChanged(bool is_visible);
- // Notifications that the view has rendered the page and that it has been
- // flushed to the screen. These messages are used to send Flush callbacks to
- // the plugin for DeviceContext2D.
+ // Notifications that the view is about to paint, has started painting, and
+ // has flushed the painted content to the screen. These messages are used to
+ // send Flush callbacks to the plugin for DeviceContext2D/3D.
+ void ViewWillInitiatePaint();
void ViewInitiatedPaint();
void ViewFlushedPaint();
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
index f76f622..5384b0f 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -347,7 +347,8 @@ int32_t PPB_Graphics2D_Impl::Flush(PP_CompletionCallback callback) {
// We need the rect to be in terms of the current clip rect of the plugin
// since that's what will actually be painted. If we issue an invalidate
// for a clipped-out region, WebKit will do nothing and we won't get any
- // ViewInitiatedPaint/ViewFlushedPaint calls, leaving our callback stranded.
+ // ViewWillInitiatePaint/ViewFlushedPaint calls, leaving our callback
+ // stranded.
gfx::Rect visible_changed_rect;
if (bound_instance_ && !op_rect.IsEmpty())
visible_changed_rect =PP_ToGfxRect(bound_instance_->view_data().clip_rect).
@@ -560,7 +561,7 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
#endif
}
-void PPB_Graphics2D_Impl::ViewInitiatedPaint() {
+void PPB_Graphics2D_Impl::ViewWillInitiatePaint() {
// Move any "unpainted" callback to the painted state. See
// |unpainted_flush_callback_| in the header for more.
if (!unpainted_flush_callback_.is_null()) {
@@ -569,6 +570,9 @@ void PPB_Graphics2D_Impl::ViewInitiatedPaint() {
}
}
+void PPB_Graphics2D_Impl::ViewInitiatedPaint() {
+}
+
void PPB_Graphics2D_Impl::ViewFlushedPaint() {
// Notify any "painted" callback. See |unpainted_flush_callback_| in the
// header for more.
diff --git a/webkit/plugins/ppapi/ppb_graphics_2d_impl.h b/webkit/plugins/ppapi/ppb_graphics_2d_impl.h
index bfe530d..80ad55a 100644
--- a/webkit/plugins/ppapi/ppb_graphics_2d_impl.h
+++ b/webkit/plugins/ppapi/ppb_graphics_2d_impl.h
@@ -64,9 +64,9 @@ class PPB_Graphics2D_Impl : public ::ppapi::Resource,
const gfx::Rect& plugin_rect,
const gfx::Rect& paint_rect);
- // Notifications that the view has rendered the page and that it has been
- // flushed to the screen. These messages are used to send Flush callbacks to
- // the plugin. See
+ // Notifications about the view's progress painting. See PluginInstance.
+ // These messages are used to send Flush callbacks to the plugin.
+ void ViewWillInitiatePaint();
void ViewInitiatedPaint();
void ViewFlushedPaint();
@@ -161,9 +161,10 @@ class PPB_Graphics2D_Impl : public ::ppapi::Resource,
// for which the ACK from the browser has not yet been received.
//
// When we get updates from a plugin with a callback, it is first added to
- // the unpainted callbacks. When the renderer has initiated a paint, we'll
- // move it to the painted callbacks list. When the renderer receives a flush,
- // we'll execute the callback and remove it from the list.
+ // the unpainted callbacks. When the renderer has initiated the paint, we move
+ // it to the painted callback. When the renderer receives a flush, we execute
+ // and clear the painted callback. This helps avoid the callback being called
+ // prematurely in response to flush notifications for a previous update.
FlushCallbackData unpainted_flush_callback_;
FlushCallbackData painted_flush_callback_;
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
index fbe89cf..4c1fc03 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -140,16 +140,19 @@ unsigned int PPB_Graphics3D_Impl::GetBackingTextureId() {
return platform_context_->GetBackingTextureId();
}
-void PPB_Graphics3D_Impl::ViewInitiatedPaint() {
+void PPB_Graphics3D_Impl::ViewWillInitiatePaint() {
}
-void PPB_Graphics3D_Impl::ViewFlushedPaint() {
+void PPB_Graphics3D_Impl::ViewInitiatedPaint() {
commit_pending_ = false;
if (HasPendingSwap())
SwapBuffersACK(PP_OK);
}
+void PPB_Graphics3D_Impl::ViewFlushedPaint() {
+}
+
gpu::CommandBuffer* PPB_Graphics3D_Impl::GetCommandBuffer() {
return platform_context_->GetCommandBuffer();
}
diff --git a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
index 09ae41a..b3eaa62 100644
--- a/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
+++ b/webkit/plugins/ppapi/ppb_graphics_3d_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,9 +46,9 @@ class PPB_Graphics3D_Impl : public ::ppapi::PPB_Graphics3D_Shared {
// Returns the id of texture that can be used by the compositor.
unsigned int GetBackingTextureId();
- // Notifications that the view has rendered the page and that it has been
- // flushed to the screen. These messages are used to send Flush callbacks to
- // the plugin.
+ // Notifications about the view's progress painting. See PluginInstance.
+ // These messages are used to send Flush callbacks to the plugin.
+ void ViewWillInitiatePaint();
void ViewInitiatedPaint();
void ViewFlushedPaint();