diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-10 20:01:35 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-10 20:01:35 +0000 |
commit | 3d1e89df95d421bcedec406019b3a9dbbf94b8c1 (patch) | |
tree | 2ed165930ca9f7520e94d49911a8245d54502478 /webkit/glue/plugins/webplugin_delegate_impl.h | |
parent | cb0ce1e02b7d16ab9024da9335ab7c70c493aa4e (diff) | |
download | chromium_src-3d1e89df95d421bcedec406019b3a9dbbf94b8c1.zip chromium_src-3d1e89df95d421bcedec406019b3a9dbbf94b8c1.tar.gz chromium_src-3d1e89df95d421bcedec406019b3a9dbbf94b8c1.tar.bz2 |
Implement the CoreAnimation drawing model for plug-ins, sharing IPC and some rendering code with the GPU Plug-in. The drawing model negotiation is currently disabled so this should have no visible impact to plug-ins.
BUG=32012
TEST=make sure the pepper GPU plug-ins still work.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins/webplugin_delegate_impl.h')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 1327464..d8bb88c 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -16,10 +16,15 @@ #include "base/gfx/rect.h" #include "base/ref_counted.h" #include "base/task.h" +#include "base/timer.h" #include "third_party/npapi/bindings/npapi.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/webplugin_delegate.h" +#if defined(OS_MACOSX) +#include "chrome/common/accelerated_surface_mac.h" +#endif + #if defined(USE_X11) typedef struct _GdkDrawable GdkPixmap; #endif @@ -32,8 +37,19 @@ namespace WebKit { class WebMouseEvent; } -// An implementation of WebPluginDelegate that proxies all calls to -// the plugin process. +#if defined(OS_MACOSX) +class CoreAnimationRedrawTimerSource; +#ifdef __OBJC__ +@class CALayer; +@class CARenderer; +#else +class CALayer; +class CARenderer; +#endif +#endif + +// An implementation of WebPluginDelegate that runs in the plugin process, +// proxied from the renderer by WebPluginDelegateProxy. class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { public: enum PluginQuirks { @@ -146,6 +162,12 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // Informs the delegate that the plugin set a Cocoa NSCursor. void SetNSCursor(NSCursor* cursor); + // Informs the browser about the updated accelerated drawing surface. + void UpdateAcceleratedSurface(); + + // Uses a CARenderer to draw the plug-in's layer in our OpenGL surface. + void DrawLayerInSurface(); + #ifndef NP_NO_CARBON // Indicates that it's time to send the plugin a null event. void FireIdleEvent(); @@ -157,10 +179,11 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { } #if defined(OS_MACOSX) - // On Mac OS X and for the GPU plugin only, this handle is a fake - // one and comes in from the outside world. + // Allow setting a "fake" window handle to associate this plug-in with + // an IOSurface in the browser. Used for accelerated drawing surfaces. void set_windowed_handle(gfx::PluginWindowHandle handle) { windowed_handle_ = handle; + UpdateAcceleratedSurface(); } #endif @@ -244,7 +267,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // used for windowed plugins // Note: on Mac OS X, the only time the windowed handle is non-zero - // is the case of the GPU plugin, which uses a fake window handle to + // is the case of accelerated rendering, which uses a fake window handle to // identify itself back to the browser. It still performs all of its // work offscreen. gfx::PluginWindowHandle windowed_handle_; @@ -301,6 +324,10 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { #ifndef NP_NO_QUICKDRAW NP_Port qd_port_; #endif + CALayer* layer_; // Used for CA drawing mode. Weak, retained by plug-in. + AcceleratedSurface* surface_; + CARenderer* renderer_; // Renders layer_ to surface_. + scoped_ptr<base::RepeatingTimer<WebPluginDelegateImpl> > redraw_timer_; #endif gfx::Rect window_rect_; gfx::Rect clip_rect_; @@ -356,7 +383,7 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { #ifndef NP_NO_CARBON // Moves our dummy window to match the current screen location of the plugin. void UpdateDummyWindowBounds(const gfx::Point& plugin_origin); - + #ifndef NP_NO_QUICKDRAW // Scrapes the contents of our dummy window into the given context. void ScrapeDummyWindowIntoContext(CGContextRef context); |