summaryrefslogtreecommitdiffstats
path: root/chrome/plugin/webplugin_proxy.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 00:38:11 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-01 00:38:11 +0000
commitc20b454f6a44ff119c0683a8228b292ba88d6044 (patch)
treefa3e0721d2c084d14eb067cdc4b7c7a8bdc7ae17 /chrome/plugin/webplugin_proxy.h
parent3deb65daf866945e0a5e211897e0d5382f3c272b (diff)
downloadchromium_src-c20b454f6a44ff119c0683a8228b292ba88d6044.zip
chromium_src-c20b454f6a44ff119c0683a8228b292ba88d6044.tar.gz
chromium_src-c20b454f6a44ff119c0683a8228b292ba88d6044.tar.bz2
Fix painting problem with transparent plugins because plugins were ignoring the alpha channel sometimes.
This change introduces another buffer which holds the background image for transparent plugins. Before painting these plugins, their backing store is overwritten with the background data. This change also uses an ACK from the renderer to figure out when it can paint, similar to how the renderer does it, which gives us throttling and also doesn't lead to painting when the tab is hidden. Review URL: http://codereview.chromium.org/5040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2744 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin/webplugin_proxy.h')
-rw-r--r--chrome/plugin/webplugin_proxy.h41
1 files changed, 27 insertions, 14 deletions
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index 9e1a051..ab50933 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -62,6 +62,12 @@ class WebPluginProxy : public WebPlugin {
// object with that id exists.
WebPluginResourceClient* GetResourceClient(int id);
+ // For windowless plugins, paints the given rectangle into the local buffer.
+ void Paint(const gfx::Rect& rect);
+
+ // Callback from the renderer to let us know that a paint occurred.
+ void DidPaint();
+
// Notification received on a plugin issued resource request
// creation.
void OnResourceCreated(int resource_id, HANDLE cookie);
@@ -77,7 +83,7 @@ class WebPluginProxy : public WebPlugin {
const gfx::Rect& clip_rect,
bool visible,
const SharedMemoryHandle& windowless_buffer,
- const SharedMemoryLock& lock);
+ const SharedMemoryHandle& background_buffer);
void CancelDocumentLoad();
@@ -90,12 +96,16 @@ class WebPluginProxy : public WebPlugin {
private:
bool Send(IPC::Message* msg);
- // Called periodically so that we can paint windowless plugins.
- void OnPaintTimerFired();
-
// Updates the shared memory section where windowless plugins paint.
- void SetWindowlessBuffer(const SharedMemoryHandle& handle,
- const SharedMemoryLock& lock);
+ void SetWindowlessBuffer(const SharedMemoryHandle& windowless_buffer,
+ const SharedMemoryHandle& background_buffer);
+
+ // Converts a shared memory section handle from the renderer process into a
+ // bitmap and hdc that are mapped to this process.
+ void ConvertBuffer(const SharedMemoryHandle& buffer,
+ ScopedHandle* shared_section,
+ ScopedBitmap* bitmap,
+ ScopedHDC* hdc);
// Called when a plugin's origin moves, so that we can update the world
// transform of the local HDC.
@@ -109,20 +119,23 @@ class WebPluginProxy : public WebPlugin {
NPObject* window_npobject_;
NPObject* plugin_element_;
WebPluginDelegateImpl* delegate_;
+ gfx::Rect damaged_rect_;
+ bool waiting_for_paint_;
uint32 cp_browsing_context_;
ScopedHandle modal_dialog_event_;
- // Used to desynchronize windowless painting. We accumulate invalidates and
- // paint into a shared buffer when our repeating timer fires. After painting
- // we tell the renderer asynchronously and it paints from the buffer. This
- // allows the renderer to paint without a blocking call, which improves
- // performance, and lets us control the frame rate at which we paint.
- gfx::Rect damaged_rect_;
- base::RepeatingTimer<WebPluginProxy> paint_timer_;
+ // Variables used for desynchronized windowless plugin painting. See note in
+ // webplugin_delegate_proxy.h for how this works.
+
+ // These hold the bitmap where the plugin draws.
ScopedHandle windowless_shared_section_;
ScopedBitmap windowless_bitmap_;
ScopedHDC windowless_hdc_;
- ScopedHandle windowless_buffer_lock_;
+
+ // These hold the bitmap of the background image.
+ ScopedHandle background_shared_section_;
+ ScopedBitmap background_bitmap_;
+ ScopedHDC background_hdc_;
};
#endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__