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_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
6 #define CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 6 #define COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util_proxy.h" | 11 #include "base/files/file_util_proxy.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/process/process.h" | 15 #include "base/process/process.h" |
16 #include "components/nacl/common/nacl_types.h" | 16 #include "components/nacl/common/nacl_types.h" |
17 #include "content/public/browser/browser_child_process_host_delegate.h" | 17 #include "content/public/browser/browser_child_process_host_delegate.h" |
18 #include "content/public/browser/browser_child_process_host_iterator.h" | 18 #include "content/public/browser/browser_child_process_host_iterator.h" |
19 #include "ipc/ipc_channel_handle.h" | 19 #include "ipc/ipc_channel_handle.h" |
20 #include "net/socket/socket_descriptor.h" | 20 #include "net/socket/socket_descriptor.h" |
21 #include "ppapi/shared_impl/ppapi_permissions.h" | 21 #include "ppapi/shared_impl/ppapi_permissions.h" |
22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
23 | 23 |
24 class CommandLine; | 24 class CommandLine; |
25 class NaClHostMessageFilter; | |
26 | 25 |
27 namespace content { | 26 namespace content { |
28 class BrowserChildProcessHost; | 27 class BrowserChildProcessHost; |
29 class BrowserPpapiHost; | 28 class BrowserPpapiHost; |
30 } | 29 } |
31 | 30 |
32 namespace IPC { | 31 namespace IPC { |
33 class ChannelProxy; | 32 class ChannelProxy; |
34 } | 33 } |
35 | 34 |
36 namespace nacl { | 35 namespace nacl { |
Mark Seaborn
2013/11/21 23:47:34
Add empty line after this line
| |
36 class NaClHostMessageFilter; | |
37 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); | 37 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); |
38 } | |
39 | 38 |
40 // Represents the browser side of the browser <--> NaCl communication | 39 // Represents the browser side of the browser <--> NaCl communication |
41 // channel. There will be one NaClProcessHost per NaCl process | 40 // channel. There will be one NaClProcessHost per NaCl process |
42 // The browser is responsible for starting the NaCl process | 41 // The browser is responsible for starting the NaCl process |
43 // when requested by the renderer. | 42 // when requested by the renderer. |
44 // After that, most of the communication is directly between NaCl plugin | 43 // After that, most of the communication is directly between NaCl plugin |
45 // running in the renderer and NaCl processes. | 44 // running in the renderer and NaCl processes. |
46 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { | 45 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { |
47 public: | 46 public: |
48 // manifest_url: the URL of the manifest of the Native Client plugin being | 47 // manifest_url: the URL of the manifest of the Native Client plugin being |
(...skipping 22 matching lines...) Expand all Loading... | |
71 const base::FilePath& profile_directory); | 70 const base::FilePath& profile_directory); |
72 virtual ~NaClProcessHost(); | 71 virtual ~NaClProcessHost(); |
73 | 72 |
74 virtual void OnProcessCrashed(int exit_status) OVERRIDE; | 73 virtual void OnProcessCrashed(int exit_status) OVERRIDE; |
75 | 74 |
76 // Do any minimal work that must be done at browser startup. | 75 // Do any minimal work that must be done at browser startup. |
77 static void EarlyStartup(); | 76 static void EarlyStartup(); |
78 | 77 |
79 // Initialize the new NaCl process. Result is returned by sending ipc | 78 // Initialize the new NaCl process. Result is returned by sending ipc |
80 // message reply_msg. | 79 // message reply_msg. |
81 void Launch(NaClHostMessageFilter* nacl_host_message_filter, | 80 void Launch(nacl::NaClHostMessageFilter* nacl_host_message_filter, |
Mark Seaborn
2013/11/21 23:47:34
"nacl::" prefix not needed. Same below.
| |
82 IPC::Message* reply_msg, | 81 IPC::Message* reply_msg, |
83 const base::FilePath& manifest_path); | 82 const base::FilePath& manifest_path); |
84 | 83 |
85 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 84 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
86 | 85 |
87 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
88 void OnProcessLaunchedByBroker(base::ProcessHandle handle); | 87 void OnProcessLaunchedByBroker(base::ProcessHandle handle); |
89 void OnDebugExceptionHandlerLaunchedByBroker(bool success); | 88 void OnDebugExceptionHandlerLaunchedByBroker(bool success); |
90 #endif | 89 #endif |
91 | 90 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 GURL manifest_url_; | 183 GURL manifest_url_; |
185 ppapi::PpapiPermissions permissions_; | 184 ppapi::PpapiPermissions permissions_; |
186 | 185 |
187 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
188 // This field becomes true when the broker successfully launched | 187 // This field becomes true when the broker successfully launched |
189 // the NaCl loader. | 188 // the NaCl loader. |
190 bool process_launched_by_broker_; | 189 bool process_launched_by_broker_; |
191 #endif | 190 #endif |
192 // The NaClHostMessageFilter that requested this NaCl process. We use | 191 // The NaClHostMessageFilter that requested this NaCl process. We use |
193 // this for sending the reply once the process has started. | 192 // this for sending the reply once the process has started. |
194 scoped_refptr<NaClHostMessageFilter> nacl_host_message_filter_; | 193 scoped_refptr<nacl::NaClHostMessageFilter> nacl_host_message_filter_; |
195 | 194 |
196 // The reply message to send. We must always send this message when the | 195 // The reply message to send. We must always send this message when the |
197 // sub-process either succeeds or fails to unblock the renderer waiting for | 196 // sub-process either succeeds or fails to unblock the renderer waiting for |
198 // the reply. NULL when there is no reply to send. | 197 // the reply. NULL when there is no reply to send. |
199 IPC::Message* reply_msg_; | 198 IPC::Message* reply_msg_; |
200 #if defined(OS_WIN) | 199 #if defined(OS_WIN) |
201 bool debug_exception_handler_requested_; | 200 bool debug_exception_handler_requested_; |
202 scoped_ptr<IPC::Message> attach_debug_exception_handler_reply_msg_; | 201 scoped_ptr<IPC::Message> attach_debug_exception_handler_reply_msg_; |
203 #endif | 202 #endif |
204 | 203 |
(...skipping 24 matching lines...) Expand all Loading... | |
229 // Plugin listener, to forward browser channel messages to us. | 228 // Plugin listener, to forward browser channel messages to us. |
230 PluginListener ipc_plugin_listener_; | 229 PluginListener ipc_plugin_listener_; |
231 // Browser host for plugin process. | 230 // Browser host for plugin process. |
232 scoped_ptr<content::BrowserPpapiHost> ppapi_host_; | 231 scoped_ptr<content::BrowserPpapiHost> ppapi_host_; |
233 | 232 |
234 int render_view_id_; | 233 int render_view_id_; |
235 | 234 |
236 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 235 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
237 }; | 236 }; |
238 | 237 |
239 #endif // CHROME_BROWSER_NACL_HOST_NACL_PROCESS_HOST_H_ | 238 } // namespace nacl |
239 | |
240 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | |
OLD | NEW |