Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4188)

Unified Diff: chrome/renderer/pepper_plugin_delegate_impl.cc

Issue 6359005: Mac Pepper: Make Image2D's TransportDIB available to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/pepper_plugin_delegate_impl.cc
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index d96fe711e017aeaa5c36adb8fb113525da82d018..8c744cee65f00520b18d0c55cbf86fc7b2f05cdb 100644
--- a/chrome/renderer/pepper_plugin_delegate_impl.cc
+++ b/chrome/renderer/pepper_plugin_delegate_impl.cc
@@ -68,12 +68,24 @@ class PlatformImage2DImpl
: public webkit::ppapi::PluginDelegate::PlatformImage2D {
public:
// This constructor will take ownership of the dib pointer.
+ // On Mac, we assume that the dib is cached by the browser, so on destruction
+ // we'll tell the browser to free it.
PlatformImage2DImpl(int width, int height, TransportDIB* dib)
: width_(width),
height_(height),
dib_(dib) {
}
+#if defined(OS_MACOSX)
+ // On Mac, we have to tell the browser to free the transport DIB.
+ virtual ~PlatformImage2DImpl() {
+ if (dib_.get()) {
+ RenderThread::current()->Send(
+ new ViewHostMsg_FreeTransportDIB(dib_->id()));
+ }
+ }
+#endif
+
virtual skia::PlatformCanvas* Map() {
return dib_->GetPlatformCanvas(width_, height_);
}
@@ -486,15 +498,12 @@ PepperPluginDelegateImpl::CreateImage2D(int width, int height) {
// work in the sandbox. Do this by sending a message to the browser
// requesting a TransportDIB (see also
// chrome/renderer/webplugin_delegate_proxy.cc, method
- // WebPluginDelegateProxy::CreateBitmap() for similar code). Note that the
- // TransportDIB is _not_ cached in the browser; this is because this memory
- // gets flushed by the renderer into another TransportDIB that represents the
- // page, which is then in turn flushed to the screen by the browser process.
- // When |transport_dib_| goes out of scope in the dtor, all of its shared
- // memory gets reclaimed.
+ // WebPluginDelegateProxy::CreateBitmap() for similar code). The TransportDIB
+ // is cached in the browser, and is freed (in typical cases) by the
+ // PlatformImage2DImpl's destructor.
TransportDIB::Handle dib_handle;
IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(buffer_size,
- false,
+ true,
&dib_handle);
if (!RenderThread::current()->Send(msg))
return NULL;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698