summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 16:21:25 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 16:21:25 +0000
commit24e863243cc6e12da33425f8401f0920170d7062 (patch)
tree670fc34a9eb817605eb6bca3fda7f46fc811f43d /chrome
parent014664d1a84c416cc67a91a9338ad08e3179050d (diff)
downloadchromium_src-24e863243cc6e12da33425f8401f0920170d7062.zip
chromium_src-24e863243cc6e12da33425f8401f0920170d7062.tar.gz
chromium_src-24e863243cc6e12da33425f8401f0920170d7062.tar.bz2
We need to set the clipping region of the HDC passed in to a windowless flash plugin instance in NPP_HandleEvent for WM_PAINT. The windowless flash plugin instance queries the clipping region of the DC and on not finding it proceeds
to paint the plugin window rect, which causes unnecessary CPU spikes. This fixes bug http://code.google.com/p/chromium/issues/detail?id=8835, where the plugin process would consume CPU even when we scrolled down to the static video images. With this fix the CPU usage for windowless flash plugins is on par with Firefox. Added a uitest which validates whether the hdc passed in to HandleEvent for WM_PAINT has a valid clipping region. Bug=8835 Review URL: http://codereview.chromium.org/53106 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12651 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/plugin/webplugin_proxy.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index 38310fb..34bdb92 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -322,9 +322,16 @@ void WebPluginProxy::Paint(const gfx::Rect& rect) {
rect.x(), rect.y(), SRCCOPY);
}
+ RECT clip_rect = rect.ToRECT();
+ HRGN clip_region = CreateRectRgnIndirect(&clip_rect);
+ SelectClipRgn(windowless_hdc_, clip_region);
+
// Before we send the invalidate, paint so that renderer uses the updated
// bitmap.
delegate_->Paint(windowless_hdc_, offset_rect);
+
+ SelectClipRgn(windowless_hdc_, NULL);
+ DeleteObject(clip_region);
}
void WebPluginProxy::UpdateGeometry(