Index: content/plugin/plugin_channel.cc |
diff --git a/content/plugin/plugin_channel.cc b/content/plugin/plugin_channel.cc |
index 0ba37737b9188bc4e228bd02ab74975afa12095b..0c4f46390730c1a0317320383b57df1ae0f1f3fd 100644 |
--- a/content/plugin/plugin_channel.cc |
+++ b/content/plugin/plugin_channel.cc |
@@ -18,6 +18,7 @@ |
#include "content/plugin/webplugin_delegate_stub.h" |
#include "content/plugin/webplugin_proxy.h" |
#include "content/public/common/content_switches.h" |
+#include "third_party/WebKit/public/web/WebBindings.h" |
#include "webkit/plugins/npapi/plugin_instance.h" |
#if defined(OS_POSIX) |
@@ -25,6 +26,8 @@ |
#include "ipc/ipc_channel_posix.h" |
#endif |
+using WebKit::WebBindings; |
+ |
namespace content { |
namespace { |
@@ -237,11 +240,17 @@ PluginChannel::PluginChannel() |
: renderer_id_(-1), |
in_send_(0), |
incognito_(false), |
- filter_(new MessageFilter()) { |
+ filter_(new MessageFilter()), |
+ npp_(new struct _NPP) { |
set_send_unblocking_only_during_unblock_dispatch(); |
ChildProcess::current()->AddRefProcess(); |
const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
log_messages_ = command_line->HasSwitch(switches::kLogPluginMessages); |
+ |
+ // Register |npp_| as the default owner for any object we receive via IPC, |
+ // and register it with WebBindings as a valid owner. |
+ SetDefaultNPObjectOwner(npp_.get()); |
+ WebBindings::registerObjectOwner(npp_.get()); |
} |
bool PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { |