diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 05:03:22 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 05:03:22 +0000 |
commit | 396c3a461549b02dcb830a287ac4656b2ca181e7 (patch) | |
tree | dfd70c68c3fc4aa501a8f1bf13bf4853d2f7faef /chrome/renderer/webplugin_delegate_pepper.h | |
parent | 29a694916746e366724f7ac6f9aa0d103894f4a9 (diff) | |
download | chromium_src-396c3a461549b02dcb830a287ac4656b2ca181e7.zip chromium_src-396c3a461549b02dcb830a287ac4656b2ca181e7.tar.gz chromium_src-396c3a461549b02dcb830a287ac4656b2ca181e7.tar.bz2 |
Make the pepper 2D flush callback actually function as advertised. It will now
get called asynchronously when the bits are actually copied to the screen,
rather than synchronously from inside the paint function. This makes it useful
for plugins to use the callback for rate limiting.
This also adds a lot of infrastructure for running tests on pepper devices, and
includes a unit test for the new flush behavior.
I made the existing RenderProcess object an abstract interface and made the
existing MockProcess (renamed to be more clear) implement that. This avoids
a static cast that would actually crash during a unit test because some code
was hardcoded to expect a RenderProcess object.
This fixes base's IDMap iterator which has apparently never been used for an
IDMap with ownership semantics.
TEST=Unit test included
BUG=none
Review URL: http://codereview.chromium.org/661124
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40490 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_pepper.h')
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index a67b530..8364a60 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -37,6 +37,8 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { const std::string& mime_type, const base::WeakPtr<RenderView>& render_view); + NPAPI::PluginInstance* instance() { return instance_.get(); } + // WebPluginDelegate implementation virtual bool Initialize(const GURL& url, const std::vector<std::string>& arg_names, @@ -144,6 +146,12 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { // Returns the path for the library implementing this plugin. FilePath GetPluginPath(); + // Notifications when the RenderView painted the screen (InitiatedPaint) and + // when an ack was received that the browser copied it to the screen + // (FlushedPaint). + void RenderViewInitiatedPaint(); + void RenderViewFlushedPaint(); + private: WebPluginDelegatePepper( const base::WeakPtr<RenderView>& render_view, @@ -157,8 +165,6 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { //----------------------------------------- // used for windowed and windowless plugins - NPAPI::PluginInstance* instance() { return instance_.get(); } - // Closes down and destroys our plugin instance. void DestroyInstance(); @@ -191,7 +197,8 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { std::vector<gfx::Rect> cutout_rects_; // Open device contexts - IDMap<Graphics2DDeviceContext, IDMapOwnPointer> graphic2d_contexts_; + typedef IDMap<Graphics2DDeviceContext, IDMapOwnPointer> Graphics2DMap; + Graphics2DMap graphic2d_contexts_; IDMap<AudioDeviceContext, IDMapOwnPointer> audio_contexts_; // Plugin graphics context implementation |