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

Unified Diff: content/plugin/webplugin_delegate_stub.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/plugin_channel.cc ('k') | content/plugin/webplugin_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/plugin/webplugin_delegate_stub.cc
diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc
index afc5022eec0ad76b855b5c7bcafd4a976a616977..9b7dd6f37dbfa95df859f71662e4ae9e9a1ae40b 100644
--- a/content/plugin/webplugin_delegate_stub.cc
+++ b/content/plugin/webplugin_delegate_stub.cc
@@ -40,6 +40,10 @@ static void DestroyWebPluginAndDelegate(
// after calling NPP_Destroy on the instance, so delete the stub now.
if (scriptable_object.get())
scriptable_object->DeleteSoon();
+
+ // Un-register the plugin instance as an object owner.
+ WebBindings::unregisterObjectOwner(delegate->GetPluginNPP());
+
// WebPlugin must outlive WebPluginDelegate.
if (delegate)
delegate->PluginDestroyed();
@@ -76,6 +80,9 @@ WebPluginDelegateStub::~WebPluginDelegateStub() {
DestroyWebPluginAndDelegate(
plugin_scriptable_object_, delegate_, webplugin_);
}
+
+ // Remove the NPObject owner mapping for this instance.
+ channel_->RemoveMappingForNPObjectOwner(instance_id_);
}
bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
@@ -175,6 +182,14 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
std::vector<std::string> arg_names = params.arg_names;
std::vector<std::string> arg_values = params.arg_values;
+ // Register the plugin as a valid object owner.
+ WebBindings::registerObjectOwner(delegate_->GetPluginNPP());
+
+ // Add an NPObject owner mapping for this instance, to support ownership
+ // tracking in the renderer.
+ channel_->AddMappingForNPObjectOwner(instance_id_,
+ delegate_->GetPluginNPP());
+
*result = delegate_->Initialize(params.url,
arg_names,
arg_values,
« no previous file with comments | « content/plugin/plugin_channel.cc ('k') | content/plugin/webplugin_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698