summaryrefslogtreecommitdiffstats
path: root/chrome/plugin
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 17:24:51 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-14 17:24:51 +0000
commitab7f2746760f15e5fab7dae6e107da26002b7d82 (patch)
tree1fce04333f2dfab22d587e471bbf84c62e6c8251 /chrome/plugin
parent64e10897fd89b86a2085ad0d47f374419ff4a9db (diff)
downloadchromium_src-ab7f2746760f15e5fab7dae6e107da26002b7d82.zip
chromium_src-ab7f2746760f15e5fab7dae6e107da26002b7d82.tar.gz
chromium_src-ab7f2746760f15e5fab7dae6e107da26002b7d82.tar.bz2
Improve plugin performance on the Mac
This makes a few changes: - Switch to memcpy instead of CG drawing to copy pixels from the transport bitmap to the backing bitmap (this is a substantial perf win). - Send transparancy information to the WebPluginDelegate, since it's no longer equivalent to not having a background DIB on the Mac (and likely on the other platforms in the future). - Don't clear the transport DIB for non-transparent plugins, since they will be drawing over whatever is there anyway. BUG=41340 TEST=Both transparent and non-transparent plugins should continue to draw correctly. Framerates for large CG plugins (e.g., in-window Netflix streaming) should be higher. Review URL: http://codereview.chromium.org/1629017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc3
-rw-r--r--chrome/plugin/webplugin_proxy.cc7
-rw-r--r--chrome/plugin/webplugin_proxy.h4
3 files changed, 10 insertions, 4 deletions
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index dd3f6a0..104c8b9 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -313,7 +313,8 @@ void WebPluginDelegateStub::OnUpdateGeometry(
const PluginMsg_UpdateGeometry_Param& param) {
webplugin_->UpdateGeometry(
param.window_rect, param.clip_rect,
- param.windowless_buffer, param.background_buffer
+ param.windowless_buffer, param.background_buffer,
+ param.transparent
#if defined(OS_MACOSX)
,
param.ack_key
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index ac04589..2dfc7a2 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -55,6 +55,7 @@ WebPluginProxy::WebPluginProxy(
waiting_for_paint_(false),
containing_window_(containing_window),
page_url_(page_url),
+ transparent_(false),
host_render_view_routing_id_(host_render_view_routing_id),
ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)) {
}
@@ -375,7 +376,7 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
scoped_cftyperef<CGImageRef> sub_image(
CGImageCreateWithImageInRect(image, source_rect));
CGContextDrawImage(windowless_context_, rect.ToCGRect(), sub_image);
- } else {
+ } else if (transparent_) {
CGContextClearRect(windowless_context_, rect.ToCGRect());
}
CGContextClipToRect(windowless_context_, rect.ToCGRect());
@@ -427,7 +428,8 @@ void WebPluginProxy::UpdateGeometry(
const gfx::Rect& window_rect,
const gfx::Rect& clip_rect,
const TransportDIB::Handle& windowless_buffer,
- const TransportDIB::Handle& background_buffer
+ const TransportDIB::Handle& background_buffer,
+ bool transparent
#if defined(OS_MACOSX)
,
int ack_key
@@ -435,6 +437,7 @@ void WebPluginProxy::UpdateGeometry(
) {
gfx::Rect old = delegate_->GetRect();
gfx::Rect old_clip_rect = delegate_->GetClipRect();
+ transparent_ = transparent;
// Update the buffers before doing anything that could call into plugin code,
// so that we don't process buffer changes out of order if plugins make
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 11cb552..f03de96 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -117,7 +117,8 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
void UpdateGeometry(const gfx::Rect& window_rect,
const gfx::Rect& clip_rect,
const TransportDIB::Handle& windowless_buffer,
- const TransportDIB::Handle& background_buffer
+ const TransportDIB::Handle& background_buffer,
+ bool transparent
#if defined(OS_MACOSX)
,
int ack_key
@@ -170,6 +171,7 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
// Variables used for desynchronized windowless plugin painting. See note in
// webplugin_delegate_proxy.h for how this works.
+ bool transparent_;
#if defined(OS_MACOSX)
scoped_ptr<TransportDIB> windowless_dib_;
scoped_ptr<TransportDIB> background_dib_;