summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 16:31:45 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 16:31:45 +0000
commitbd6d99a40c955ec7e7253fed69c719f22a460c91 (patch)
treea24cf85cb6edbb70570dea8a597b73a1c998193c /chrome
parent24319273088f4a151b9e00c10aea01ef0df3dd47 (diff)
downloadchromium_src-bd6d99a40c955ec7e7253fed69c719f22a460c91.zip
chromium_src-bd6d99a40c955ec7e7253fed69c719f22a460c91.tar.gz
chromium_src-bd6d99a40c955ec7e7253fed69c719f22a460c91.tar.bz2
Free transport DIBs and associated shared memory when a WebPluginDelegateProxy
is destroyed. On the Mac, transport DIBs are allocated by the browser process (due to the sandbox) and are also freed by the browser process. This change causes the renderer to ask the browser to free allocated transport DIBs when a WebPluginDelegateProxy is destroyed. This avoids a shared memory leak and file descriptor leak in the browser process. BUG=38383 TEST=Using test_chrome_fd_leak from bug 38383 and lsof, the browser process should not show an fd leak on Mac. Review URL: http://codereview.chromium.org/1789006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc25
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index ca1b12b..5533c86 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -155,6 +155,15 @@ class ResourceClientProxy : public webkit_glue::WebPluginResourceClient {
bool multibyte_response_expected_;
};
+#if defined(OS_MACOSX)
+static void ReleaseTransportDIB(TransportDIB* dib) {
+ if (dib) {
+ IPC::Message* message = new ViewHostMsg_FreeTransportDIB(dib->id());
+ RenderThread::current()->Send(message);
+ }
+}
+#endif
+
WebPluginDelegateProxy::WebPluginDelegateProxy(
const std::string& mime_type,
const base::WeakPtr<RenderView>& render_view)
@@ -172,6 +181,11 @@ WebPluginDelegateProxy::WebPluginDelegateProxy(
}
WebPluginDelegateProxy::~WebPluginDelegateProxy() {
+#if defined(OS_MACOSX)
+ ReleaseTransportDIB(backing_store_.get());
+ ReleaseTransportDIB(transport_store_.get());
+ ReleaseTransportDIB(background_store_.get());
+#endif
}
void WebPluginDelegateProxy::PluginDestroyed() {
@@ -581,7 +595,7 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
#if defined (OS_WIN)
if (UseSynchronousGeometryUpdates()) {
msg = new PluginMsg_UpdateGeometrySync(instance_id_, param);
- } else // NO_LINT
+ } else // NOLINT
#endif
{
msg = new PluginMsg_UpdateGeometry(instance_id_, param);
@@ -591,15 +605,6 @@ void WebPluginDelegateProxy::UpdateGeometry(const gfx::Rect& window_rect,
Send(msg);
}
-#if defined(OS_MACOSX)
-static void ReleaseTransportDIB(TransportDIB *dib) {
- if (dib) {
- IPC::Message* msg = new ViewHostMsg_FreeTransportDIB(dib->id());
- RenderThread::current()->Send(msg);
- }
-}
-#endif
-
void WebPluginDelegateProxy::ResetWindowlessBitmaps() {
#if defined(OS_MACOSX)
if (backing_store_.get()) {