summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc14
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.h11
-rw-r--r--chrome/renderer/render_view.cc5
-rw-r--r--chrome/renderer/render_view.h2
-rw-r--r--chrome/renderer/render_widget.cc8
-rw-r--r--chrome/renderer/render_widget.h3
6 files changed, 42 insertions, 1 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index 40ef961..bc11d6c 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -7,6 +7,7 @@
#include "app/surface/transport_dib.h"
#include "base/scoped_ptr.h"
#include "webkit/glue/plugins/pepper_plugin_instance.h"
+#include "webkit/glue/webkit_glue.h"
#if defined(OS_MACOSX)
#include "chrome/common/render_messages.h"
@@ -131,3 +132,16 @@ PepperPluginDelegateImpl::CreateImage2D(int width, int height) {
return new PlatformImage2DImpl(width, height, dib);
}
+
+bool PepperPluginDelegateImpl::OptimizedPluginPaintInRect(
+ skia::PlatformCanvas* canvas,
+ const gfx::Rect& rect) {
+ for (std::set<pepper::PluginInstance*>::iterator i = active_instances_.begin();
+ i != active_instances_.end(); ++i) {
+ if ((*i)->position().Contains(rect)) {
+ (*i)->Paint(webkit_glue::ToWebCanvas(canvas), (*i)->position(), rect);
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.h b/chrome/renderer/pepper_plugin_delegate_impl.h
index 2edb4dd..c7a106e 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.h
+++ b/chrome/renderer/pepper_plugin_delegate_impl.h
@@ -18,6 +18,14 @@ namespace pepper {
class PluginInstance;
}
+namespace skia {
+class PlatformCanvas;
+}
+
+namespace gfx {
+class Rect;
+}
+
class PepperPluginDelegateImpl
: public pepper::PluginDelegate,
public base::SupportsWeakPtr<PepperPluginDelegateImpl> {
@@ -29,6 +37,9 @@ class PepperPluginDelegateImpl
void ViewInitiatedPaint();
void ViewFlushedPaint();
+ bool OptimizedPluginPaintInRect(skia::PlatformCanvas* canvas,
+ const gfx::Rect& rect);
+
// pepper::PluginDelegate implementation.
virtual void InstanceCreated(pepper::PluginInstance* instance);
virtual void InstanceDeleted(pepper::PluginInstance* instance);
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 1c14bd0..19d9904 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -5007,6 +5007,11 @@ void RenderView::DidHandleKeyEvent() {
edit_commands_.clear();
}
+bool RenderView::OptimizedPluginPaintInRect(skia::PlatformCanvas* canvas,
+ const gfx::Rect& rect) {
+ return pepper_delegate_.OptimizedPluginPaintInRect(canvas, rect);
+}
+
#if defined(OS_MACOSX)
void RenderView::OnWasHidden() {
RenderWidget::OnWasHidden();
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index e98d22c..1defef1 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -568,6 +568,8 @@ class RenderView : public RenderWidget,
virtual void OnWasHidden();
virtual void OnWasRestored(bool needs_repainting);
#endif
+ virtual bool OptimizedPluginPaintInRect(skia::PlatformCanvas* canvas,
+ const gfx::Rect& rect);
private:
// For unit tests.
diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
index fe0d3c1..37ea5a4 100644
--- a/chrome/renderer/render_widget.cc
+++ b/chrome/renderer/render_widget.cc
@@ -395,7 +395,8 @@ void RenderWidget::PaintRect(const gfx::Rect& rect,
canvas->drawPaint(paint);
}
- webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect);
+ if (!OptimizedPluginPaintInRect(canvas, rect))
+ webwidget_->paint(webkit_glue::ToWebCanvas(canvas), rect);
PaintDebugBorder(rect, canvas);
@@ -975,3 +976,8 @@ void RenderWidget::CleanupWindowInPluginMoves(gfx::PluginWindowHandle window) {
}
}
}
+
+bool RenderWidget::OptimizedPluginPaintInRect(skia::PlatformCanvas* canvas,
+ const gfx::Rect& rect) {
+ return false;
+}
diff --git a/chrome/renderer/render_widget.h b/chrome/renderer/render_widget.h
index 4086137..d2c8347 100644
--- a/chrome/renderer/render_widget.h
+++ b/chrome/renderer/render_widget.h
@@ -215,6 +215,9 @@ class RenderWidget : public IPC::Channel::Listener,
// just handled.
virtual void DidHandleKeyEvent() {}
+ virtual bool OptimizedPluginPaintInRect(skia::PlatformCanvas* canvas,
+ const gfx::Rect& rect);
+
// Routing ID that allows us to communicate to the parent browser process
// RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
int32 routing_id_;