summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.cc20
-rw-r--r--content/renderer/pepper_plugin_delegate_impl.h4
-rw-r--r--content/renderer/render_view_impl.cc7
-rw-r--r--content/renderer/render_view_impl.h3
-rw-r--r--content/renderer/render_widget.cc21
-rw-r--r--content/renderer/render_widget.h12
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.cc4
-rw-r--r--content/renderer/render_widget_fullscreen_pepper.h4
-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
14 files changed, 41 insertions, 88 deletions
diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
index eda1108..b736ef5 100644
--- a/content/renderer/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper_plugin_delegate_impl.cc
@@ -996,30 +996,18 @@ bool PepperPluginDelegateImpl::StopWaitingForPpapiBrokerConnection(
return false;
}
-void PepperPluginDelegateImpl::ViewWillInitiatePaint() {
+void PepperPluginDelegateImpl::ViewInitiatedPaint() {
// Notify all of our instances that we started painting. This is used for
// internal bookkeeping only, so we know that the set can not change under
// us.
for (std::set<webkit::ppapi::PluginInstance*>::iterator i =
active_instances_.begin();
i != active_instances_.end(); ++i)
- (*i)->ViewWillInitiatePaint();
-}
-
-void PepperPluginDelegateImpl::ViewInitiatedPaint() {
- // Notify all instances that we painted. The same caveats apply as for
- // ViewFlushedPaint regarding instances closing themselves, so we take
- // similar precautions.
- std::set<webkit::ppapi::PluginInstance*> plugins = active_instances_;
- for (std::set<webkit::ppapi::PluginInstance*>::iterator i = plugins.begin();
- i != plugins.end(); ++i) {
- if (active_instances_.find(*i) != active_instances_.end())
- (*i)->ViewInitiatedPaint();
- }
+ (*i)->ViewInitiatedPaint();
}
void PepperPluginDelegateImpl::ViewFlushedPaint() {
- // Notify all instances that we flushed. This will call into the plugin, and
+ // Notify all instances that we painted. This will call into the plugin, and
// we it may ask to close itself as a result. This will, in turn, modify our
// set, possibly invalidating the iterator. So we iterate on a copy that
// won't change out from under us.
@@ -1040,7 +1028,7 @@ void PepperPluginDelegateImpl::ViewFlushedPaint() {
// What about the case where a new one is created in a callback at a new
// address and we don't issue the callback? We're still OK since this
// callback is used for flush callbacks and we could not have possibly
- // started a new paint (ViewWillInitiatePaint) for the new plugin while
+ // started a new paint (ViewInitiatedPaint) for the new plugin while
// processing a previous paint for an existing one.
if (active_instances_.find(*i) != active_instances_.end())
(*i)->ViewFlushedPaint();
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h
index 1cba5eb..22de0d5 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -151,9 +151,7 @@ class PepperPluginDelegateImpl
bool* pepper_plugin_was_registered);
// Called by RenderView to tell us about painting events, these two functions
- // just correspond to the WillInitiatePaint, DidInitiatePaint and
- // DidFlushPaint hooks in RenderView.
- void ViewWillInitiatePaint();
+ // just correspond to the DidInitiatePaint and DidFlushPaint in R.V..
void ViewInitiatedPaint();
void ViewFlushedPaint();
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index f4dc033..c8eb610 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -4299,13 +4299,8 @@ void RenderViewImpl::OnResize(const gfx::Size& new_size,
RenderWidget::OnResize(new_size, resizer_rect, is_fullscreen);
}
-void RenderViewImpl::WillInitiatePaint() {
- // Notify the pepper plugins that we're about to paint.
- pepper_delegate_.ViewWillInitiatePaint();
-}
-
void RenderViewImpl::DidInitiatePaint() {
- // Notify the pepper plugins that we've painted, and are waiting to flush.
+ // Notify the pepper plugins that we started painting.
pepper_delegate_.ViewInitiatedPaint();
}
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index 7602f26..b892a80 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -623,6 +623,7 @@ class RenderViewImpl : public RenderWidget,
// Please do not add your stuff randomly to the end here. If there is an
// appropriate section, add it there. If not, there are some random functions
// nearer to the top you can add it to.
+ virtual void DidFlushPaint() OVERRIDE;
// Cannot use std::set unfortunately since linked_ptr<> does not support
// operator<.
@@ -635,9 +636,7 @@ class RenderViewImpl : public RenderWidget,
virtual void OnResize(const gfx::Size& new_size,
const gfx::Rect& resizer_rect,
bool is_fullscreen) OVERRIDE;
- virtual void WillInitiatePaint() OVERRIDE;
virtual void DidInitiatePaint() OVERRIDE;
- virtual void DidFlushPaint() OVERRIDE;
virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
const gfx::Rect& paint_bounds,
TransportDIB** dib,
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 50b1b07..2895623 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -374,8 +374,9 @@ void RenderWidget::OnUpdateRectAck() {
return;
}
- // Notify subclasses that software rendering was flushed to the screen.
- DidFlushPaint();
+ // Notify subclasses.
+ if (!is_accelerated_compositing_active_)
+ DidFlushPaint();
// Continue painting if necessary...
DoDeferredUpdateAndSendInputAck();
@@ -420,10 +421,6 @@ void RenderWidget::OnSwapBuffersPosted() {
void RenderWidget::OnSwapBuffersComplete() {
TRACE_EVENT0("renderer", "RenderWidget::OnSwapBuffersComplete");
-
- // Notify subclasses that composited rendering got flushed to the screen.
- DidFlushPaint();
-
// When compositing deactivates, we reset the swapbuffers pending count. The
// swapbuffers acks may still arrive, however.
if (num_swapbuffers_complete_pending_ == 0) {
@@ -805,9 +802,6 @@ void RenderWidget::DoDeferredUpdate() {
gfx::Rect scroll_damage = update.GetScrollDamage();
gfx::Rect bounds = update.GetPaintBounds().Union(scroll_damage);
- // Notify derived classes that we're about to initiate a paint.
- WillInitiatePaint();
-
// A plugin may be able to do an optimized paint. First check this, in which
// case we can skip all of the bitmap generation and regular paint code.
// This optimization allows PPAPI plugins that declare themselves on top of
@@ -911,9 +905,8 @@ void RenderWidget::DoDeferredUpdate() {
UpdateTextInputState();
UpdateSelectionBounds();
- // If we're software rendering then we're done initiating the paint.
- if (!is_accelerated_compositing_active_)
- DidInitiatePaint();
+ // Let derived classes know we've painted.
+ DidInitiatePaint();
}
///////////////////////////////////////////////////////////////////////////////
@@ -1039,8 +1032,8 @@ void RenderWidget::didCommitAndDrawCompositorFrame() {
// Accelerated FPS tick for performance tests. See throughput_tests.cc.
// NOTE: Tests may break if this event is renamed or moved.
UNSHIPPED_TRACE_EVENT_INSTANT0("test_fps", "TestFrameTickGPU");
- // Notify subclasses that we initiated the paint operation.
- DidInitiatePaint();
+ // Notify subclasses.
+ DidFlushPaint();
}
void RenderWidget::didCompleteSwapBuffers() {
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 3b072e8..5c11923 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -233,14 +233,10 @@ class CONTENT_EXPORT RenderWidget
void OnSetTextDirection(WebKit::WebTextDirection direction);
void OnGetFPS();
- // Override points to notify derived classes that a paint has happened.
- // WillInitiatePaint happens when we're about to generate a new bitmap and
- // send it to the browser. DidInitiatePaint happens when that has completed,
- // and subsequent rendering won't affect the painted content. DidFlushPaint
- // happens once we've received the ACK that the screen has been updated.
- // For a given paint operation, these overrides will always be called in the
- // order WillInitiatePaint, DidInitiatePaint, DidFlushPaint.
- virtual void WillInitiatePaint() {}
+ // Override point to notify derived classes that a paint has happened.
+ // DidInitiatePaint happens when we've generated a new bitmap and sent it to
+ // the browser. DidFlushPaint happens once we've received the ACK that the
+ // screen has actually been updated.
virtual void DidInitiatePaint() {}
virtual void DidFlushPaint() {}
diff --git a/content/renderer/render_widget_fullscreen_pepper.cc b/content/renderer/render_widget_fullscreen_pepper.cc
index 35c9437e..919cccc 100644
--- a/content/renderer/render_widget_fullscreen_pepper.cc
+++ b/content/renderer/render_widget_fullscreen_pepper.cc
@@ -284,9 +284,9 @@ RenderWidgetFullscreenPepper::CreateContext3D() {
#endif
}
-void RenderWidgetFullscreenPepper::WillInitiatePaint() {
+void RenderWidgetFullscreenPepper::DidInitiatePaint() {
if (plugin_)
- plugin_->ViewWillInitiatePaint();
+ plugin_->ViewInitiatedPaint();
}
void RenderWidgetFullscreenPepper::DidFlushPaint() {
diff --git a/content/renderer/render_widget_fullscreen_pepper.h b/content/renderer/render_widget_fullscreen_pepper.h
index 9179668..75e1fea 100644
--- a/content/renderer/render_widget_fullscreen_pepper.h
+++ b/content/renderer/render_widget_fullscreen_pepper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -53,7 +53,7 @@ class RenderWidgetFullscreenPepper : public RenderWidgetFullscreen,
virtual ~RenderWidgetFullscreenPepper();
// RenderWidget API.
- virtual void WillInitiatePaint() OVERRIDE;
+ virtual void DidInitiatePaint() OVERRIDE;
virtual void DidFlushPaint() OVERRIDE;
virtual void Close() OVERRIDE;
virtual webkit::ppapi::PluginInstance* GetBitmapForOptimizedPluginPaint(
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 38c8a5d..7622a63 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -809,13 +809,6 @@ 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 0156cda..1287111 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -192,10 +192,9 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// Notification about page visibility. The default is "visible".
void PageVisibilityChanged(bool is_visible);
- // 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();
+ // 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.
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 5384b0f..f76f622 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) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,8 +347,7 @@ 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
- // ViewWillInitiatePaint/ViewFlushedPaint calls, leaving our callback
- // stranded.
+ // ViewInitiatedPaint/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).
@@ -561,7 +560,7 @@ void PPB_Graphics2D_Impl::Paint(WebKit::WebCanvas* canvas,
#endif
}
-void PPB_Graphics2D_Impl::ViewWillInitiatePaint() {
+void PPB_Graphics2D_Impl::ViewInitiatedPaint() {
// Move any "unpainted" callback to the painted state. See
// |unpainted_flush_callback_| in the header for more.
if (!unpainted_flush_callback_.is_null()) {
@@ -570,9 +569,6 @@ void PPB_Graphics2D_Impl::ViewWillInitiatePaint() {
}
}
-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 80ad55a..bfe530d 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 about the view's progress painting. See PluginInstance.
- // These messages are used to send Flush callbacks to the plugin.
- void ViewWillInitiatePaint();
+ // 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
void ViewInitiatedPaint();
void ViewFlushedPaint();
@@ -161,10 +161,9 @@ 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 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.
+ // 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.
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 4c1fc03..fbe89cf 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) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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,19 +140,16 @@ unsigned int PPB_Graphics3D_Impl::GetBackingTextureId() {
return platform_context_->GetBackingTextureId();
}
-void PPB_Graphics3D_Impl::ViewWillInitiatePaint() {
+void PPB_Graphics3D_Impl::ViewInitiatedPaint() {
}
-void PPB_Graphics3D_Impl::ViewInitiatedPaint() {
+void PPB_Graphics3D_Impl::ViewFlushedPaint() {
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 b3eaa62..09ae41a 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) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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 about the view's progress painting. See PluginInstance.
- // These messages are used to send Flush callbacks to the plugin.
- void ViewWillInitiatePaint();
+ // 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.
void ViewInitiatedPaint();
void ViewFlushedPaint();