summaryrefslogtreecommitdiffstats
path: root/chrome/nacl
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/nacl')
-rw-r--r--chrome/nacl/broker_thread.cc9
-rw-r--r--chrome/nacl/broker_thread.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/chrome/nacl/broker_thread.cc b/chrome/nacl/broker_thread.cc
index 832c73a7..f94d49d 100644
--- a/chrome/nacl/broker_thread.cc
+++ b/chrome/nacl/broker_thread.cc
@@ -8,10 +8,11 @@
#include "base/command_line.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#include "chrome/common/sandbox_policy.h"
+#include "chrome/common/child_process.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/nacl_cmd_line.h"
#include "chrome/common/nacl_messages.h"
+#include "chrome/common/sandbox_policy.h"
#include "ipc/ipc_switches.h"
NaClBrokerThread::NaClBrokerThread()
@@ -31,6 +32,7 @@ void NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) {
IPC_BEGIN_MESSAGE_MAP(NaClBrokerThread, msg)
IPC_MESSAGE_HANDLER(NaClProcessMsg_LaunchLoaderThroughBroker,
OnLaunchLoaderThroughBroker)
+ IPC_MESSAGE_HANDLER(NaClProcessMsg_StopBroker, OnStopBroker)
IPC_END_MESSAGE_MAP()
}
@@ -64,9 +66,14 @@ void NaClBrokerThread::OnLaunchLoaderThroughBroker(
loader_handle_in_browser));
}
+void NaClBrokerThread::OnStopBroker() {
+ ChildProcess::current()->ReleaseProcess();
+}
+
void NaClBrokerThread::OnChannelConnected(int32 peer_pid) {
bool res = base::OpenProcessHandle(peer_pid, &browser_handle_);
DCHECK(res);
+ ChildProcess::current()->AddRefProcess();
Send(new NaClProcessMsg_BrokerReady());
}
diff --git a/chrome/nacl/broker_thread.h b/chrome/nacl/broker_thread.h
index d88919f..fb4cf40 100644
--- a/chrome/nacl/broker_thread.h
+++ b/chrome/nacl/broker_thread.h
@@ -27,6 +27,7 @@ class NaClBrokerThread : public ChildThread {
virtual void OnControlMessageReceived(const IPC::Message& msg);
void OnLaunchLoaderThroughBroker(const std::wstring& loader_channel_id);
void OnShareBrowserHandle(int browser_handle);
+ void OnStopBroker();
base::ProcessHandle browser_handle_;
sandbox::BrokerServices* broker_services_;