OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_NACL_NACL_BROKER_LISTENER_H_ | 5 #ifndef CHROME_NACL_NACL_BROKER_LISTENER_H_ |
6 #define CHROME_NACL_NACL_BROKER_LISTENER_H_ | 6 #define CHROME_NACL_NACL_BROKER_LISTENER_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "chrome/common/nacl_types.h" | 10 #include "chrome/common/nacl_types.h" |
11 #include "ipc/ipc_channel.h" | 11 #include "ipc/ipc_listener.h" |
| 12 |
| 13 namespace IPC { |
| 14 class Channel; |
| 15 } |
12 | 16 |
13 // The BrokerThread class represents the thread that handles the messages from | 17 // The BrokerThread class represents the thread that handles the messages from |
14 // the browser process and starts NaCl loader processes. | 18 // the browser process and starts NaCl loader processes. |
15 class NaClBrokerListener : public IPC::Listener { | 19 class NaClBrokerListener : public IPC::Listener { |
16 public: | 20 public: |
17 NaClBrokerListener(); | 21 NaClBrokerListener(); |
18 ~NaClBrokerListener(); | 22 ~NaClBrokerListener(); |
19 | 23 |
20 void Listen(); | 24 void Listen(); |
21 | 25 |
22 // IPC::Listener implementation. | 26 // IPC::Listener implementation. |
23 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 27 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
24 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 28 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
25 virtual void OnChannelError() OVERRIDE; | 29 virtual void OnChannelError() OVERRIDE; |
26 | 30 |
27 private: | 31 private: |
28 void OnLaunchLoaderThroughBroker(const std::string& loader_channel_id); | 32 void OnLaunchLoaderThroughBroker(const std::string& loader_channel_id); |
29 void OnLaunchDebugExceptionHandler(int32 pid, | 33 void OnLaunchDebugExceptionHandler(int32 pid, |
30 base::ProcessHandle process_handle, | 34 base::ProcessHandle process_handle, |
31 const std::string& startup_info); | 35 const std::string& startup_info); |
32 void OnStopBroker(); | 36 void OnStopBroker(); |
33 | 37 |
34 base::ProcessHandle browser_handle_; | 38 base::ProcessHandle browser_handle_; |
35 scoped_ptr<IPC::Channel> channel_; | 39 scoped_ptr<IPC::Channel> channel_; |
36 | 40 |
37 DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener); | 41 DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener); |
38 }; | 42 }; |
39 | 43 |
40 #endif // CHROME_NACL_NACL_BROKER_LISTENER_H_ | 44 #endif // CHROME_NACL_NACL_BROKER_LISTENER_H_ |
OLD | NEW |