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 COMPONENTS_NACL_BROWSER_NACL_BROKER_HOST_WIN_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_BROKER_HOST_WIN_H_ |
6 #define COMPONENTS_NACL_BROWSER_NACL_BROKER_HOST_WIN_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_BROKER_HOST_WIN_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/basictypes.h" | 12 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/process/process.h" | 14 #include "base/process/process.h" |
13 #include "content/public/browser/browser_child_process_host_delegate.h" | 15 #include "content/public/browser/browser_child_process_host_delegate.h" |
14 | 16 |
15 namespace content { | 17 namespace content { |
16 class BrowserChildProcessHost; | 18 class BrowserChildProcessHost; |
17 } | 19 } |
18 | 20 |
19 namespace nacl { | 21 namespace nacl { |
20 | 22 |
21 class NaClBrokerHost : public content::BrowserChildProcessHostDelegate { | 23 class NaClBrokerHost : public content::BrowserChildProcessHostDelegate { |
22 public: | 24 public: |
23 NaClBrokerHost(); | 25 NaClBrokerHost(); |
24 ~NaClBrokerHost() override; | 26 ~NaClBrokerHost() override; |
25 | 27 |
26 // This function starts the broker process. It needs to be called | 28 // This function starts the broker process. It needs to be called |
27 // before loaders can be launched. | 29 // before loaders can be launched. |
28 bool Init(); | 30 bool Init(); |
29 | 31 |
30 // Send a message to the broker process, causing it to launch | 32 // Send a message to the broker process, causing it to launch |
31 // a Native Client loader process. | 33 // a Native Client loader process. |
32 bool LaunchLoader(const std::string& loader_channel_id); | 34 bool LaunchLoader(const std::string& loader_channel_id); |
33 | 35 |
34 bool LaunchDebugExceptionHandler(int32 pid, | 36 bool LaunchDebugExceptionHandler(int32_t pid, |
35 base::ProcessHandle process_handle, | 37 base::ProcessHandle process_handle, |
36 const std::string& startup_info); | 38 const std::string& startup_info); |
37 | 39 |
38 // Stop the broker process. | 40 // Stop the broker process. |
39 void StopBroker(); | 41 void StopBroker(); |
40 | 42 |
41 // Returns true if the process has been asked to terminate. If true, this | 43 // Returns true if the process has been asked to terminate. If true, this |
42 // object should no longer be used; it will eventually be destroyed by | 44 // object should no longer be used; it will eventually be destroyed by |
43 // BrowserChildProcessHostImpl::OnChildDisconnected() | 45 // BrowserChildProcessHostImpl::OnChildDisconnected() |
44 bool IsTerminating() { return is_terminating_; } | 46 bool IsTerminating() { return is_terminating_; } |
45 | 47 |
46 private: | 48 private: |
47 // Handler for NaClProcessMsg_LoaderLaunched message | 49 // Handler for NaClProcessMsg_LoaderLaunched message |
48 void OnLoaderLaunched(const std::string& loader_channel_id, | 50 void OnLoaderLaunched(const std::string& loader_channel_id, |
49 base::ProcessHandle handle); | 51 base::ProcessHandle handle); |
50 // Handler for NaClProcessMsg_DebugExceptionHandlerLaunched message | 52 // Handler for NaClProcessMsg_DebugExceptionHandlerLaunched message |
51 void OnDebugExceptionHandlerLaunched(int32 pid, bool success); | 53 void OnDebugExceptionHandlerLaunched(int32_t pid, bool success); |
52 | 54 |
53 // BrowserChildProcessHostDelegate implementation: | 55 // BrowserChildProcessHostDelegate implementation: |
54 bool OnMessageReceived(const IPC::Message& msg) override; | 56 bool OnMessageReceived(const IPC::Message& msg) override; |
55 | 57 |
56 scoped_ptr<content::BrowserChildProcessHost> process_; | 58 scoped_ptr<content::BrowserChildProcessHost> process_; |
57 bool is_terminating_; | 59 bool is_terminating_; |
58 | 60 |
59 DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); | 61 DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); |
60 }; | 62 }; |
61 | 63 |
62 } // namespace nacl | 64 } // namespace nacl |
63 | 65 |
64 #endif // COMPONENTS_NACL_BROWSER_NACL_BROKER_HOST_WIN_H_ | 66 #endif // COMPONENTS_NACL_BROWSER_NACL_BROKER_HOST_WIN_H_ |
OLD | NEW |