summaryrefslogtreecommitdiffstats
path: root/chrome/nacl
diff options
context:
space:
mode:
authorgregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 17:27:12 +0000
committergregoryd@google.com <gregoryd@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 17:27:12 +0000
commitc891d223b30349e9b4c475effd329e1e74e681ce (patch)
treee33ccedefc2240db25370a0d8a21748c286c0064 /chrome/nacl
parent207c678c4692c9dfec3e34c0d206f2ee1b2fbb6a (diff)
downloadchromium_src-c891d223b30349e9b4c475effd329e1e74e681ce.zip
chromium_src-c891d223b30349e9b4c475effd329e1e74e681ce.tar.gz
chromium_src-c891d223b30349e9b4c475effd329e1e74e681ce.tar.bz2
Terminate NaCl broker process when no loader processes are running
BUG=none TEST=none Review URL: http://codereview.chromium.org/669019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40744 0039d316-1c4b-4281-b951-d872f2087c98
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_;