diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 05:45:55 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-03 05:45:55 +0000 |
commit | 503b1574e293e27e90b8d009ea1cec56961e7907 (patch) | |
tree | 9b29fcc9cb049c125ee2f9472accc6381042d18b /chrome/renderer/pepper_devices.h | |
parent | be9827184d20dea9dd7b7bfaa6e727e34af59d9d (diff) | |
download | chromium_src-503b1574e293e27e90b8d009ea1cec56961e7907.zip chromium_src-503b1574e293e27e90b8d009ea1cec56961e7907.tar.gz chromium_src-503b1574e293e27e90b8d009ea1cec56961e7907.tar.bz2 |
Revert 40490 - 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
TBR=brettw@chromium.org
Review URL: http://codereview.chromium.org/660439
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/pepper_devices.h')
-rw-r--r-- | chrome/renderer/pepper_devices.h | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/chrome/renderer/pepper_devices.h b/chrome/renderer/pepper_devices.h index f608735..24fa506 100644 --- a/chrome/renderer/pepper_devices.h +++ b/chrome/renderer/pepper_devices.h @@ -6,7 +6,6 @@ #define CHROME_RENDERER_PEPPER_DEVICES_H_ #include "base/basictypes.h" -#include "base/gfx/rect.h" #include "base/scoped_ptr.h" #include "base/shared_memory.h" #include "base/simple_thread.h" @@ -18,16 +17,12 @@ #include "third_party/npapi/bindings/npapi_extensions.h" #include "third_party/skia/include/core/SkBitmap.h" -class WebPluginDelegatePepper; - // Lists all contexts currently open for painting. These are ones requested by // the plugin but not destroyed by it yet. The source pointer is the raw // pixels. We use this to look up the corresponding transport DIB when the // plugin tells us to flush or destroy it. class Graphics2DDeviceContext { public: - explicit Graphics2DDeviceContext(WebPluginDelegatePepper* plugin_delegate); - NPError Initialize(gfx::Rect window_rect, const NPDeviceContext2DConfig* config, NPDeviceContext2D* context); @@ -36,57 +31,15 @@ class Graphics2DDeviceContext { NPDeviceFlushContextCallbackPtr callback, NPP id, void* user_data); - // Notifications that the render view has rendered the page and that it has - // been flushed to the screen. - void RenderViewInitiatedPaint(); - void RenderViewFlushedPaint(); - TransportDIB* transport_dib() { return transport_dib_.get(); } private: - struct FlushCallbackData { - FlushCallbackData(NPDeviceFlushContextCallbackPtr f, - NPP n, - NPDeviceContext2D* c, - NPUserData* u) - : function(f), - npp(n), - context(c), - user_data(u) { - } - - NPDeviceFlushContextCallbackPtr function; - NPP npp; - NPDeviceContext2D* context; - NPUserData* user_data; - }; - typedef std::vector<FlushCallbackData> FlushCallbackVector; - - WebPluginDelegatePepper* plugin_delegate_; - static int32 next_buffer_id_; scoped_ptr<TransportDIB> transport_dib_; // The canvas associated with the transport DIB, containing the mapped // memory of the image. scoped_ptr<skia::PlatformCanvas> canvas_; - - // The plugin may be constantly giving us paint messages. "Unpainted" ones - // are paint requests which have never been painted. These could have been - // done while the RenderView was already waiting for an ACK from a previous - // paint, so won't generate a new one yet. - // - // "Painted" ones are those paints that have been painted by RenderView, but - // for which the ACK from the browser has not yet been received. - // - // When we get updates from a plugin with a callback, it is first added to - // the unpainted callbacks. When the renderer has initiated a paint, we'll - // move it to the painted callbacks list. When the renderer receives a flush, - // we'll execute the callback and remove it from the list. - FlushCallbackVector unpainted_flush_callbacks_; - FlushCallbackVector painted_flush_callbacks_; - - DISALLOW_COPY_AND_ASSIGN(Graphics2DDeviceContext); }; |