summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorsehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 19:14:43 +0000
committersehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 19:14:43 +0000
commit761caa4b594ceb7ce534f0abc8e68243204b900d (patch)
tree3cfc96b11fc8eea60bb9ec50f3e1a308c5d0acca /chrome/renderer
parente398ce857ae54166af4be5d5e516a157db8347eb (diff)
downloadchromium_src-761caa4b594ceb7ce534f0abc8e68243204b900d.zip
chromium_src-761caa4b594ceb7ce534f0abc8e68243204b900d.tar.gz
chromium_src-761caa4b594ceb7ce534f0abc8e68243204b900d.tar.bz2
Expose the TransportDIB through the reserved pointer so that the NaCl pepper host can
find it to transfer to the NaCl module. Review URL: http://codereview.chromium.org/500121 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 1cc5358..5fc549c 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -43,6 +43,11 @@ const uint32 kBytesPerPixel = 4; // Only 8888 RGBA for now.
} // namespace
+// Implementation artifacts for a context
+struct Device2DImpl {
+ TransportDIB* dib;
+};
+
uint32 WebPluginDelegatePepper::next_buffer_id = 0;
WebPluginDelegatePepper* WebPluginDelegatePepper::Create(
@@ -246,6 +251,9 @@ NPError WebPluginDelegatePepper::Device2DInitializeContext(
int height = window_rect_.height();
uint32 buffer_size = width * height * kBytesPerPixel;
+ // Initialize the impelementation information in case of failure.
+ context->reserved = NULL;
+
// Allocate the transport DIB and the PlatformCanvas pointing to it.
scoped_ptr<OpenPaintContext> paint_context(new OpenPaintContext);
paint_context->transport_dib.reset(
@@ -270,6 +278,15 @@ NPError WebPluginDelegatePepper::Device2DInitializeContext(
// catch areas you didn't paint.
plugin_bitmap.eraseARGB(0, 0, 0, 0);
+ // Save the implementation information (the TransportDIB).
+ Device2DImpl* impl = new Device2DImpl;
+ if (impl == NULL) {
+ // TODO(sehr,brettw): cleanup the context if we fail.
+ return NPERR_GENERIC_ERROR;
+ }
+ impl->dib = paint_context->transport_dib.get();
+ context->reserved = reinterpret_cast<void*>(impl);
+
// Save the canvas to the output context structure and save the
// OpenPaintContext for future reference.
context->region = plugin_bitmap.getAddr32(0, 0);
@@ -280,6 +297,7 @@ NPError WebPluginDelegatePepper::Device2DInitializeContext(
context->dirty.bottom = height;
open_paint_contexts_[context->region] =
linked_ptr<OpenPaintContext>(paint_context.release());
+
return NPERR_NO_ERROR;
}
@@ -355,6 +373,8 @@ NPError WebPluginDelegatePepper::Device2DDestroyContext(
return NPERR_INVALID_PARAM;
open_paint_contexts_.erase(found);
+ // Free the implementation information.
+ delete reinterpret_cast<Device2DImpl*>(context->reserved);
return NPERR_NO_ERROR;
}