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

Unified Diff: content/renderer/pepper/pepper_platform_image_2d_impl.cc

Issue 10879050: Revert 139366 - [OSX/Pepper] Don't have browser cache shmem ref behind ImageData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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: content/renderer/pepper/pepper_platform_image_2d_impl.cc
===================================================================
--- content/renderer/pepper/pepper_platform_image_2d_impl.cc (revision 153060)
+++ content/renderer/pepper/pepper_platform_image_2d_impl.cc (working copy)
@@ -5,8 +5,6 @@
#include "content/renderer/pepper/pepper_platform_image_2d_impl.h"
#include "build/build_config.h"
-
-#include "base/metrics/histogram.h"
#include "content/common/view_messages.h"
#include "content/renderer/render_thread_impl.h"
#include "ui/surface/transport_dib.h"
@@ -21,14 +19,20 @@
dib_(dib) {
}
+// On Mac, we have to tell the browser to free the transport DIB.
PepperPlatformImage2DImpl::~PepperPlatformImage2DImpl() {
+#if defined(OS_MACOSX)
+ if (dib_.get()) {
+ RenderThreadImpl::current()->Send(
+ new ViewHostMsg_FreeTransportDIB(dib_->id()));
+ }
+#endif
}
// static
PepperPlatformImage2DImpl* PepperPlatformImage2DImpl::Create(int width,
int height) {
uint32 buffer_size = width * height * 4;
- UMA_HISTOGRAM_COUNTS("Plugin.PepperImage2DSize", buffer_size);
// Allocate the transport DIB and the PlatformCanvas pointing to it.
#if defined(OS_MACOSX)
@@ -36,10 +40,12 @@
// 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).
+ // WebPluginDelegateProxy::CreateBitmap() for similar code). The TransportDIB
+ // is cached in the browser, and is freed (in typical cases) by the
+ // PepperPlatformImage2DImpl's destructor.
TransportDIB::Handle dib_handle;
IPC::Message* msg = new ViewHostMsg_AllocTransportDIB(buffer_size,
- false,
+ true,
&dib_handle);
if (!RenderThreadImpl::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