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