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

Unified Diff: content/renderer/webplugin_delegate_proxy.cc

Issue 17208003: Track NPObject ownership by the originating plugins' NPP identifier. [4/6] (Chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove DCHECKs on proxy and stub maps. Created 7 years, 6 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 | « content/plugin/webplugin_proxy.cc ('k') | webkit/plugins/npapi/webplugin_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/webplugin_delegate_proxy.cc
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index bcf1740b574903314db6b63867ed25e317589b70..1176743dcdfaf4f9772235bb2dd6449cc897125e 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -258,6 +258,10 @@ void WebPluginDelegateProxy::PluginDestroyed() {
// channel went away if this was the last instance.
channel_host_->RemoveRoute(instance_id_);
+ // Remove the mapping between our instance-Id and NPP identifiers, used by
+ // the channel to track object ownership, before releasing it.
+ channel_host_->RemoveMappingForNPObjectOwner(instance_id_);
+
// Release the channel host now. If we are is the last reference to the
// channel, this avoids a race where this renderer asks a new connection to
// the same plugin between now and the time 'this' is actually deleted.
@@ -275,6 +279,7 @@ void WebPluginDelegateProxy::PluginDestroyed() {
// been destroyed by WebKit, at which point WebKit will forcibly deallocate
// the window script object. The window script object stub is unique to the
// plugin instance, so this won't affect other instances.
+ // TODO(wez): Remove this hack.
window_script_object_->DeleteSoon();
}
@@ -363,6 +368,10 @@ bool WebPluginDelegateProxy::Initialize(
channel_host_->AddRoute(instance_id_, this, NULL);
+ // Inform the channel of the mapping between our instance-Id and dummy NPP
+ // identifier, for use in object ownership tracking.
+ channel_host_->AddMappingForNPObjectOwner(instance_id_, GetPluginNPP());
+
// Now tell the PluginInstance in the plugin process to initialize.
PluginMsg_Init_Params params;
params.url = url;
@@ -739,7 +748,7 @@ NPObject* WebPluginDelegateProxy::GetPluginScriptableObject() {
return NULL;
npobject_ = NPObjectProxy::Create(
- channel_host_.get(), route_id, 0, page_url_);
+ channel_host_.get(), route_id, 0, page_url_, GetPluginNPP());
return WebBindings::retainObject(npobject_);
}
« no previous file with comments | « content/plugin/webplugin_proxy.cc ('k') | webkit/plugins/npapi/webplugin_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698