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 <vector> |
| 11 |
10 #include "base/files/file.h" | 12 #include "base/files/file.h" |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/files/file_util_proxy.h" | 14 #include "base/files/file_util_proxy.h" |
13 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
14 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
15 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
16 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
17 #include "base/process/process.h" | 19 #include "base/process/process.h" |
18 #include "components/nacl/common/nacl_types.h" | 20 #include "components/nacl/common/nacl_types.h" |
19 #include "content/public/browser/browser_child_process_host_delegate.h" | 21 #include "content/public/browser/browser_child_process_host_delegate.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // The browser is responsible for starting the NaCl process | 55 // The browser is responsible for starting the NaCl process |
54 // when requested by the renderer. | 56 // when requested by the renderer. |
55 // After that, most of the communication is directly between NaCl plugin | 57 // After that, most of the communication is directly between NaCl plugin |
56 // running in the renderer and NaCl processes. | 58 // running in the renderer and NaCl processes. |
57 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { | 59 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { |
58 public: | 60 public: |
59 // manifest_url: the URL of the manifest of the Native Client plugin being | 61 // manifest_url: the URL of the manifest of the Native Client plugin being |
60 // executed. | 62 // executed. |
61 // nexe_file: A file that corresponds to the nexe module to be loaded. | 63 // nexe_file: A file that corresponds to the nexe module to be loaded. |
62 // nexe_token: A cache validation token for nexe_file. | 64 // nexe_token: A cache validation token for nexe_file. |
| 65 // prefetched_resource_files_info: An array of resource files prefetched. |
63 // permissions: PPAPI permissions, to control access to private APIs. | 66 // permissions: PPAPI permissions, to control access to private APIs. |
64 // render_view_id: RenderView routing id, to control access to private APIs. | 67 // render_view_id: RenderView routing id, to control access to private APIs. |
65 // permission_bits: controls which interfaces the NaCl plugin can use. | 68 // permission_bits: controls which interfaces the NaCl plugin can use. |
66 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode. | 69 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode. |
67 // off_the_record: was the process launched from an incognito renderer? | 70 // off_the_record: was the process launched from an incognito renderer? |
68 // process_type: the type of NaCl process. | 71 // process_type: the type of NaCl process. |
69 // profile_directory: is the path of current profile directory. | 72 // profile_directory: is the path of current profile directory. |
70 NaClProcessHost(const GURL& manifest_url, | 73 NaClProcessHost( |
71 base::File nexe_file, | 74 const GURL& manifest_url, |
72 const NaClFileToken& nexe_token, | 75 base::File nexe_file, |
73 ppapi::PpapiPermissions permissions, | 76 const NaClFileToken& nexe_token, |
74 int render_view_id, | 77 const std::vector< |
75 uint32 permission_bits, | 78 nacl::NaClResourceFileInfo>& prefetched_resource_files_info, |
76 bool uses_nonsfi_mode, | 79 ppapi::PpapiPermissions permissions, |
77 bool off_the_record, | 80 int render_view_id, |
78 NaClAppProcessType process_type, | 81 uint32 permission_bits, |
79 const base::FilePath& profile_directory); | 82 bool uses_nonsfi_mode, |
| 83 bool off_the_record, |
| 84 NaClAppProcessType process_type, |
| 85 const base::FilePath& profile_directory); |
80 ~NaClProcessHost() override; | 86 ~NaClProcessHost() override; |
81 | 87 |
82 void OnProcessCrashed(int exit_status) override; | 88 void OnProcessCrashed(int exit_status) override; |
83 | 89 |
84 // Do any minimal work that must be done at browser startup. | 90 // Do any minimal work that must be done at browser startup. |
85 static void EarlyStartup(); | 91 static void EarlyStartup(); |
86 | 92 |
87 // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. | 93 // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. |
88 static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds); | 94 static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds); |
89 | 95 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 // created. | 191 // created. |
186 void OnPpapiChannelsCreated( | 192 void OnPpapiChannelsCreated( |
187 const IPC::ChannelHandle& browser_channel_handle, | 193 const IPC::ChannelHandle& browser_channel_handle, |
188 const IPC::ChannelHandle& ppapi_renderer_channel_handle, | 194 const IPC::ChannelHandle& ppapi_renderer_channel_handle, |
189 const IPC::ChannelHandle& trusted_renderer_channel_handle, | 195 const IPC::ChannelHandle& trusted_renderer_channel_handle, |
190 const IPC::ChannelHandle& manifest_service_channel_handle); | 196 const IPC::ChannelHandle& manifest_service_channel_handle); |
191 | 197 |
192 GURL manifest_url_; | 198 GURL manifest_url_; |
193 base::File nexe_file_; | 199 base::File nexe_file_; |
194 NaClFileToken nexe_token_; | 200 NaClFileToken nexe_token_; |
| 201 std::vector<nacl::NaClResourceFileInfo> prefetched_resource_files_info_; |
195 | 202 |
196 ppapi::PpapiPermissions permissions_; | 203 ppapi::PpapiPermissions permissions_; |
197 | 204 |
198 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
199 // This field becomes true when the broker successfully launched | 206 // This field becomes true when the broker successfully launched |
200 // the NaCl loader. | 207 // the NaCl loader. |
201 bool process_launched_by_broker_; | 208 bool process_launched_by_broker_; |
202 #endif | 209 #endif |
203 // The NaClHostMessageFilter that requested this NaCl process. We use | 210 // The NaClHostMessageFilter that requested this NaCl process. We use |
204 // this for sending the reply once the process has started. | 211 // this for sending the reply once the process has started. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 base::File socket_for_sel_ldr_; | 253 base::File socket_for_sel_ldr_; |
247 | 254 |
248 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 255 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
249 | 256 |
250 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 257 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
251 }; | 258 }; |
252 | 259 |
253 } // namespace nacl | 260 } // namespace nacl |
254 | 261 |
255 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 262 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
OLD | NEW |