OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/nacl/broker_thread.h" | 5 #include "chrome/nacl/broker_thread.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 NaClBrokerThread::~NaClBrokerThread() { | 23 NaClBrokerThread::~NaClBrokerThread() { |
24 base::CloseProcessHandle(browser_handle_); | 24 base::CloseProcessHandle(browser_handle_); |
25 } | 25 } |
26 | 26 |
27 NaClBrokerThread* NaClBrokerThread::current() { | 27 NaClBrokerThread* NaClBrokerThread::current() { |
28 return static_cast<NaClBrokerThread*>(ChildThread::current()); | 28 return static_cast<NaClBrokerThread*>(ChildThread::current()); |
29 } | 29 } |
30 | 30 |
31 void NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) { | 31 bool NaClBrokerThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 32 bool handled = true; |
32 IPC_BEGIN_MESSAGE_MAP(NaClBrokerThread, msg) | 33 IPC_BEGIN_MESSAGE_MAP(NaClBrokerThread, msg) |
33 IPC_MESSAGE_HANDLER(NaClProcessMsg_LaunchLoaderThroughBroker, | 34 IPC_MESSAGE_HANDLER(NaClProcessMsg_LaunchLoaderThroughBroker, |
34 OnLaunchLoaderThroughBroker) | 35 OnLaunchLoaderThroughBroker) |
35 IPC_MESSAGE_HANDLER(NaClProcessMsg_StopBroker, OnStopBroker) | 36 IPC_MESSAGE_HANDLER(NaClProcessMsg_StopBroker, OnStopBroker) |
| 37 IPC_MESSAGE_UNHANDLED(handled = false) |
36 IPC_END_MESSAGE_MAP() | 38 IPC_END_MESSAGE_MAP() |
| 39 return handled; |
37 } | 40 } |
38 | 41 |
39 void NaClBrokerThread::OnLaunchLoaderThroughBroker( | 42 void NaClBrokerThread::OnLaunchLoaderThroughBroker( |
40 const std::wstring& loader_channel_id) { | 43 const std::wstring& loader_channel_id) { |
41 base::ProcessHandle loader_process = 0; | 44 base::ProcessHandle loader_process = 0; |
42 base::ProcessHandle loader_handle_in_browser = 0; | 45 base::ProcessHandle loader_handle_in_browser = 0; |
43 | 46 |
44 // Create the path to the nacl broker/loader executable - it's the executable | 47 // Create the path to the nacl broker/loader executable - it's the executable |
45 // this code is running in. | 48 // this code is running in. |
46 FilePath exe_path; | 49 FilePath exe_path; |
(...skipping 23 matching lines...) Expand all Loading... |
70 void NaClBrokerThread::OnStopBroker() { | 73 void NaClBrokerThread::OnStopBroker() { |
71 ChildProcess::current()->ReleaseProcess(); | 74 ChildProcess::current()->ReleaseProcess(); |
72 } | 75 } |
73 | 76 |
74 void NaClBrokerThread::OnChannelConnected(int32 peer_pid) { | 77 void NaClBrokerThread::OnChannelConnected(int32 peer_pid) { |
75 bool res = base::OpenProcessHandle(peer_pid, &browser_handle_); | 78 bool res = base::OpenProcessHandle(peer_pid, &browser_handle_); |
76 DCHECK(res); | 79 DCHECK(res); |
77 ChildProcess::current()->AddRefProcess(); | 80 ChildProcess::current()->AddRefProcess(); |
78 } | 81 } |
79 | 82 |
OLD | NEW |