summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 18:31:52 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-19 18:31:52 +0000
commit3705f8e68cb154810dba9f9e05b3f9fb2a9155b5 (patch)
treea38baa1fcf2ec16846a31a49bacfaab82842edfc /chrome
parentc93a4c15da177442be707e7b024525a87cddbc09 (diff)
downloadchromium_src-3705f8e68cb154810dba9f9e05b3f9fb2a9155b5.zip
chromium_src-3705f8e68cb154810dba9f9e05b3f9fb2a9155b5.tar.gz
chromium_src-3705f8e68cb154810dba9f9e05b3f9fb2a9155b5.tar.bz2
Mac Pepper: Make Image2D's TransportDIB available to the browser.
This mirrors the behaviour on other platforms, and allows the optimized Pepper plugin painting path to be used (see RenderWidget::DoDeferredUpdate()). BUG=none TEST=MacFlapper paints correctly in the "windowed" case Review URL: http://codereview.chromium.org/6359005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/pepper_plugin_delegate_impl.cc23
1 files changed, 16 insertions, 7 deletions
diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc
index fc8a1cd..2492e90 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_);
}
@@ -487,15 +499,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;