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

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 15007012: Track NPObject ownership by the originating plugins' NPP identifier. [2/3] (Chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing forward-define. Created 7 years, 7 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
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 46b9ec4a25919e6dced358f18c01b04802221476..c64e66c574f5cc4d80333d156a4b3a21fdeb3740 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -1137,6 +1137,9 @@ bool BrowserPlugin::initialize(WebPluginContainer* container) {
if (!GetContentClient()->renderer()->AllowBrowserPlugin(container))
return false;
+ // Tell |container| to allow this plugin to use script objects.
+ container->allowScriptObjects();
+
bindings_.reset(new BrowserPluginBindings(this));
container_ = container;
container_->setWantsWheelEvents(true);
@@ -1180,6 +1183,9 @@ void BrowserPlugin::EnableCompositing(bool enable) {
}
void BrowserPlugin::destroy() {
+ // Tell |container_| to clear references to this plugin's script objects.
+ container_->clearScriptObjects();
+
// The BrowserPlugin's WebPluginContainer is deleted immediately after this
// call returns, so let's not keep a reference to it around.
g_plugin_container_map.Get().erase(container_);
@@ -1202,6 +1208,13 @@ NPObject* BrowserPlugin::scriptableObject() {
return browser_plugin_np_object;
}
+NPP BrowserPlugin::pluginNPP() {
+ // We must return the same pointer that the NPP parameter to NPObject binding
+ // calls will contain. WebKit will treat it as opaque, though, so it needn't
+ // be an actual NPP_t instance.
+ return reinterpret_cast<NPP>(this);
jamesr 2013/05/21 18:20:21 nak, if you're going to leave the type NPP_t*, ret
Wez 2013/05/22 06:55:25 Done.
+}
+
bool BrowserPlugin::supportsKeyboardFocus() const {
return true;
}

Powered by Google App Engine
This is Rietveld 408576698