summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/webplugin_delegate_pepper.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 00:25:22 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 00:25:22 +0000
commitc7ebd253c9d06f1abeb44ca4acb0b26dd3752e7f (patch)
tree4d5b5faaba98606875ed296bf6bfea9b6d54098b /chrome/renderer/webplugin_delegate_pepper.h
parent0dc78175ae33d022a8db10e8e010defe6ccc3623 (diff)
downloadchromium_src-c7ebd253c9d06f1abeb44ca4acb0b26dd3752e7f.zip
chromium_src-c7ebd253c9d06f1abeb44ca4acb0b26dd3752e7f.tar.gz
chromium_src-c7ebd253c9d06f1abeb44ca4acb0b26dd3752e7f.tar.bz2
Rework painting to be something that will actually work. This allows plugins to
only paint portions of their backing store. This also implements correct memory management on the chrome side. We can now supply more than one backing store, and will delete them properly when requested by the plugin. TEST=none BUG=none Review URL: http://codereview.chromium.org/371093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_pepper.h')
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h
index caba02a..7e2f09b 100644
--- a/chrome/renderer/webplugin_delegate_pepper.h
+++ b/chrome/renderer/webplugin_delegate_pepper.h
@@ -7,12 +7,13 @@
#include "build/build_config.h"
-#include <list>
+#include <map>
#include <string>
#include <vector>
#include "app/gfx/native_widget_types.h"
#include "base/file_path.h"
+#include "base/linked_ptr.h"
#include "base/gfx/rect.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
@@ -97,6 +98,7 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate {
// used for windowless plugins
virtual NPError InitializeRenderContext(NPRenderType type,
NPRenderContext* context);
+ virtual NPError DestroyRenderContext(NPRenderContext* context);
virtual NPError FlushRenderContext(NPRenderContext* context);
virtual NPError OpenFileInSandbox(const char* file_name, void** handle);
@@ -126,9 +128,22 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate {
size_t buffer_size_;
TransportDIB* plugin_buffer_;
static uint32 next_buffer_id;
- scoped_ptr<skia::PlatformCanvas> plugin_canvas_;
SkBitmap committed_bitmap_;
+ // 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.
+ struct OpenPaintContext {
+ scoped_ptr<TransportDIB> transport_dib;
+
+ // The canvas associated with the transport DIB, containing the mapped
+ // memory of the image.
+ scoped_ptr<skia::PlatformCanvas> canvas;
+ };
+ typedef std::map< void*, linked_ptr<OpenPaintContext> > OpenPaintContextMap;
+ OpenPaintContextMap open_paint_contexts_;
+
// The url with which the plugin was instantiated.
std::string plugin_url_;