| 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_PROCESS_HOST_H_ | 5 #ifndef COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
| 6 #define COMPONENTS_NACL_BROWSER_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.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util_proxy.h" | 12 #include "base/files/file_util_proxy.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "components/nacl/common/nacl_types.h" | 17 #include "components/nacl/common/nacl_types.h" |
| 18 #include "content/public/browser/browser_child_process_host_delegate.h" | 18 #include "content/public/browser/browser_child_process_host_delegate.h" |
| 19 #include "content/public/browser/browser_child_process_host_iterator.h" | 19 #include "content/public/browser/browser_child_process_host_iterator.h" |
| 20 #include "ipc/ipc_channel_handle.h" | 20 #include "ipc/ipc_channel_handle.h" |
| 21 #include "native_client/src/public/nacl_file_info.h" | |
| 22 #include "net/socket/socket_descriptor.h" | 21 #include "net/socket/socket_descriptor.h" |
| 23 #include "ppapi/shared_impl/ppapi_permissions.h" | 22 #include "ppapi/shared_impl/ppapi_permissions.h" |
| 24 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 25 | 24 |
| 26 namespace content { | 25 namespace content { |
| 27 class BrowserChildProcessHost; | 26 class BrowserChildProcessHost; |
| 28 class BrowserPpapiHost; | 27 class BrowserPpapiHost; |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace IPC { | 30 namespace IPC { |
| 32 class ChannelProxy; | 31 class ChannelProxy; |
| 33 } | 32 } |
| 34 | 33 |
| 35 namespace nacl { | 34 namespace nacl { |
| 36 | 35 |
| 37 class NaClHostMessageFilter; | 36 class NaClHostMessageFilter; |
| 38 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); | 37 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); |
| 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 |
| 49 // executed. | 48 // executed. |
| 50 // nexe_file: A file that corresponds to the nexe module to be loaded. | |
| 51 // nexe_token: A cache validation token for nexe_file. | |
| 52 // permissions: PPAPI permissions, to control access to private APIs. | 49 // permissions: PPAPI permissions, to control access to private APIs. |
| 53 // render_view_id: RenderView routing id, to control access to private APIs. | 50 // render_view_id: RenderView routing id, to control access to private APIs. |
| 54 // permission_bits: controls which interfaces the NaCl plugin can use. | 51 // permission_bits: controls which interfaces the NaCl plugin can use. |
| 55 // uses_irt: whether the launched process should use the IRT. | 52 // uses_irt: whether the launched process should use the IRT. |
| 56 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode. | 53 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode. |
| 57 // enable_dyncode_syscalls: whether the launched process should allow dyncode | 54 // enable_dyncode_syscalls: whether the launched process should allow dyncode |
| 58 // and mmap with PROT_EXEC. | 55 // and mmap with PROT_EXEC. |
| 59 // enable_exception_handling: whether the launched process should allow | 56 // enable_exception_handling: whether the launched process should allow |
| 60 // hardware exception handling. | 57 // hardware exception handling. |
| 61 // enable_crash_throttling: whether a crash of this process contributes | 58 // enable_crash_throttling: whether a crash of this process contributes |
| 62 // to the crash throttling statistics, and also | 59 // to the crash throttling statistics, and also |
| 63 // whether this process should not start when too | 60 // whether this process should not start when too |
| 64 // many crashes have been observed. | 61 // many crashes have been observed. |
| 65 // off_the_record: was the process launched from an incognito renderer? | 62 // off_the_record: was the process launched from an incognito renderer? |
| 66 // profile_directory: is the path of current profile directory. | 63 // profile_directory: is the path of current profile directory. |
| 67 NaClProcessHost(const GURL& manifest_url, | 64 NaClProcessHost(const GURL& manifest_url, |
| 68 base::File nexe_file, | 65 base::File nexe_file, |
| 69 NaClFileToken nexe_token, | |
| 70 ppapi::PpapiPermissions permissions, | 66 ppapi::PpapiPermissions permissions, |
| 71 int render_view_id, | 67 int render_view_id, |
| 72 uint32 permission_bits, | 68 uint32 permission_bits, |
| 73 bool uses_irt, | 69 bool uses_irt, |
| 74 bool uses_nonsfi_mode, | 70 bool uses_nonsfi_mode, |
| 75 bool enable_dyncode_syscalls, | 71 bool enable_dyncode_syscalls, |
| 76 bool enable_exception_handling, | 72 bool enable_exception_handling, |
| 77 bool enable_crash_throttling, | 73 bool enable_crash_throttling, |
| 78 bool off_the_record, | 74 bool off_the_record, |
| 79 const base::FilePath& profile_directory); | 75 const base::FilePath& profile_directory); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // Called when the PPAPI IPC channels to the browser/renderer have been | 182 // Called when the PPAPI IPC channels to the browser/renderer have been |
| 187 // created. | 183 // created. |
| 188 void OnPpapiChannelsCreated( | 184 void OnPpapiChannelsCreated( |
| 189 const IPC::ChannelHandle& browser_channel_handle, | 185 const IPC::ChannelHandle& browser_channel_handle, |
| 190 const IPC::ChannelHandle& ppapi_renderer_channel_handle, | 186 const IPC::ChannelHandle& ppapi_renderer_channel_handle, |
| 191 const IPC::ChannelHandle& trusted_renderer_channel_handle, | 187 const IPC::ChannelHandle& trusted_renderer_channel_handle, |
| 192 const IPC::ChannelHandle& manifest_service_channel_handle); | 188 const IPC::ChannelHandle& manifest_service_channel_handle); |
| 193 | 189 |
| 194 GURL manifest_url_; | 190 GURL manifest_url_; |
| 195 base::File nexe_file_; | 191 base::File nexe_file_; |
| 196 NaClFileToken nexe_token_; | |
| 197 | 192 |
| 198 ppapi::PpapiPermissions permissions_; | 193 ppapi::PpapiPermissions permissions_; |
| 199 | 194 |
| 200 #if defined(OS_WIN) | 195 #if defined(OS_WIN) |
| 201 // This field becomes true when the broker successfully launched | 196 // This field becomes true when the broker successfully launched |
| 202 // the NaCl loader. | 197 // the NaCl loader. |
| 203 bool process_launched_by_broker_; | 198 bool process_launched_by_broker_; |
| 204 #endif | 199 #endif |
| 205 // The NaClHostMessageFilter that requested this NaCl process. We use | 200 // The NaClHostMessageFilter that requested this NaCl process. We use |
| 206 // this for sending the reply once the process has started. | 201 // this for sending the reply once the process has started. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 242 |
| 248 // Throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. | 243 // Throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. |
| 249 static unsigned keepalive_throttle_interval_milliseconds_; | 244 static unsigned keepalive_throttle_interval_milliseconds_; |
| 250 | 245 |
| 251 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 246 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
| 252 }; | 247 }; |
| 253 | 248 |
| 254 } // namespace nacl | 249 } // namespace nacl |
| 255 | 250 |
| 256 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 251 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
| OLD | NEW |