diff options
Diffstat (limited to 'chrome/plugin/webplugin_proxy.h')
-rw-r--r-- | chrome/plugin/webplugin_proxy.h | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h index 092bf32..9e1a051 100644 --- a/chrome/plugin/webplugin_proxy.h +++ b/chrome/plugin/webplugin_proxy.h @@ -8,12 +8,14 @@ #include "base/hash_tables.h" #include "base/ref_counted.h" #include "base/scoped_handle.h" +#include "base/shared_memory.h" +#include "base/timer.h" #include "chrome/common/ipc_message.h" #include "chrome/common/chrome_plugin_api.h" #include "webkit/glue/webplugin.h" class PluginChannel; -class WebPluginDelegate; +class WebPluginDelegateImpl; // This is an implementation of WebPlugin that proxies all calls to the // renderer. @@ -23,7 +25,7 @@ class WebPluginProxy : public WebPlugin { // marshalled WebPlugin calls. WebPluginProxy(PluginChannel* channel, int route_id, - WebPluginDelegate* delegate, + WebPluginDelegateImpl* delegate, HANDLE modal_dialog_event); ~WebPluginProxy(); @@ -60,8 +62,6 @@ class WebPluginProxy : public WebPlugin { // object with that id exists. WebPluginResourceClient* GetResourceClient(int id); - void WillPaint(); - // Notification received on a plugin issued resource request // creation. void OnResourceCreated(int resource_id, HANDLE cookie); @@ -73,6 +73,12 @@ class WebPluginProxy : public WebPlugin { bool notify, const char* url, void* notify_data, bool popups_allowed); + void UpdateGeometry(const gfx::Rect& window_rect, + const gfx::Rect& clip_rect, + bool visible, + const SharedMemoryHandle& windowless_buffer, + const SharedMemoryLock& lock); + void CancelDocumentLoad(); void InitiateHTTPRangeRequest(const char* url, @@ -80,9 +86,21 @@ class WebPluginProxy : public WebPlugin { void* existing_stream, bool notify_needed, HANDLE notify_data); + 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); + + // Called when a plugin's origin moves, so that we can update the world + // transform of the local HDC. + void UpdateTransform(); + typedef base::hash_map<int, WebPluginResourceClient*> ResourceClientMap; ResourceClientMap resource_clients_; @@ -90,11 +108,21 @@ class WebPluginProxy : public WebPlugin { int route_id_; NPObject* window_npobject_; NPObject* plugin_element_; - WebPluginDelegate* delegate_; - gfx::Rect damaged_rect_; - bool waiting_for_paint_; + WebPluginDelegateImpl* delegate_; 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_; + ScopedHandle windowless_shared_section_; + ScopedBitmap windowless_bitmap_; + ScopedHDC windowless_hdc_; + ScopedHandle windowless_buffer_lock_; }; #endif // CHROME_PLUGIN_PLUGIN_WEBPLUGIN_PROXY_H__ |