summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 17:32:19 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-03 17:32:19 +0000
commit176c7392aadbb01cfd885e0a1aaea7e850d8d99a (patch)
treeb39bae2c61985c991ee0591cdcb3e684a7389e2f /ppapi
parentd2bc6742a48ce48bd957cd812bf327dbfa7dce13 (diff)
downloadchromium_src-176c7392aadbb01cfd885e0a1aaea7e850d8d99a.zip
chromium_src-176c7392aadbb01cfd885e0a1aaea7e850d8d99a.tar.gz
chromium_src-176c7392aadbb01cfd885e0a1aaea7e850d8d99a.tar.bz2
Implement PPAPI proxy shutdown.
This just adds a message from the dispatcher in the renderer to the one in the plugin to terminate the process. The PpapiPluginProcessHost in the browser automatically cleans everything up when there's an IPC channel error. TEST=none BUG=none Review URL: http://codereview.chromium.org/5533002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/proxy/host_dispatcher.cc3
-rw-r--r--ppapi/proxy/plugin_dispatcher.cc12
-rw-r--r--ppapi/proxy/plugin_dispatcher.h5
-rw-r--r--ppapi/proxy/ppapi_messages_internal.h2
4 files changed, 18 insertions, 4 deletions
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index a717af8..fd9801c 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "ppapi/proxy/host_var_serialization_rules.h"
+#include "ppapi/proxy/ppapi_messages.h"
namespace pp {
namespace proxy {
@@ -28,6 +29,8 @@ HostDispatcher::HostDispatcher(base::ProcessHandle remote_process_handle,
}
HostDispatcher::~HostDispatcher() {
+ // Notify the plugin that it should exit.
+ Send(new PpapiMsg_Shutdown());
}
// static
diff --git a/ppapi/proxy/plugin_dispatcher.cc b/ppapi/proxy/plugin_dispatcher.cc
index 4c9adca..037b470 100644
--- a/ppapi/proxy/plugin_dispatcher.cc
+++ b/ppapi/proxy/plugin_dispatcher.cc
@@ -70,7 +70,8 @@ void PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
if (msg.routing_id() == MSG_ROUTING_CONTROL) {
// Handle some plugin-specific control messages.
IPC_BEGIN_MESSAGE_MAP(PluginDispatcher, msg)
- IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnInitializeModule)
+ IPC_MESSAGE_HANDLER(PpapiMsg_InitializeModule, OnMsgInitializeModule)
+ IPC_MESSAGE_HANDLER(PpapiMsg_Shutdown, OnMsgShutdown)
// Forward all other control messages to the superclass.
IPC_MESSAGE_UNHANDLED(Dispatcher::OnMessageReceived(msg))
@@ -82,11 +83,18 @@ void PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
Dispatcher::OnMessageReceived(msg);
}
-void PluginDispatcher::OnInitializeModule(PP_Module pp_module, bool* result) {
+void PluginDispatcher::OnMsgInitializeModule(PP_Module pp_module,
+ bool* result) {
set_pp_module(pp_module);
*result = init_module_(pp_module, &GetInterfaceFromDispatcher) == PP_OK;
}
+void PluginDispatcher::OnMsgShutdown() {
+ if (shutdown_module_)
+ shutdown_module_();
+ MessageLoop::current()->Quit();
+}
+
} // namespace proxy
} // namespace pp
diff --git a/ppapi/proxy/plugin_dispatcher.h b/ppapi/proxy/plugin_dispatcher.h
index 79eafb1..8c75d33 100644
--- a/ppapi/proxy/plugin_dispatcher.h
+++ b/ppapi/proxy/plugin_dispatcher.h
@@ -61,8 +61,9 @@ class PluginDispatcher : public Dispatcher {
}
private:
- // IPC message handler.
- void OnInitializeModule(PP_Module pp_module, bool* result);
+ // IPC message handlers.
+ void OnMsgInitializeModule(PP_Module pp_module, bool* result);
+ void OnMsgShutdown();
InitModuleFunc init_module_;
ShutdownModuleFunc shutdown_module_;
diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h
index 1f854af..5259725 100644
--- a/ppapi/proxy/ppapi_messages_internal.h
+++ b/ppapi/proxy/ppapi_messages_internal.h
@@ -22,6 +22,8 @@ IPC_BEGIN_MESSAGES(Ppapi)
PP_Module /* module_id */,
bool /* result */)
+ IPC_MESSAGE_CONTROL0(PpapiMsg_Shutdown)
+
// Sent in both directions to see if the other side supports the given
// interface.
IPC_SYNC_MESSAGE_CONTROL1_1(PpapiMsg_SupportsInterface,