summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/plugins/ppapi')
-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();