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 <stddef.h> |
| 11 #include <stdint.h> |
| 12 |
10 #include <vector> | 13 #include <vector> |
11 | 14 |
12 #include "base/files/file.h" | 15 #include "base/files/file.h" |
13 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
14 #include "base/files/file_util_proxy.h" | 17 #include "base/files/file_util_proxy.h" |
| 18 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
16 #include "base/memory/shared_memory.h" | 20 #include "base/memory/shared_memory.h" |
17 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
18 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
19 #include "base/process/process.h" | 23 #include "base/process/process.h" |
20 #include "components/nacl/common/nacl_types.h" | 24 #include "components/nacl/common/nacl_types.h" |
21 #include "content/public/browser/browser_child_process_host_delegate.h" | 25 #include "content/public/browser/browser_child_process_host_delegate.h" |
22 #include "content/public/browser/browser_child_process_host_iterator.h" | 26 #include "content/public/browser/browser_child_process_host_iterator.h" |
23 #include "ipc/ipc_channel_handle.h" | 27 #include "ipc/ipc_channel_handle.h" |
24 #include "net/socket/socket_descriptor.h" | 28 #include "net/socket/socket_descriptor.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // off_the_record: was the process launched from an incognito renderer? | 74 // off_the_record: was the process launched from an incognito renderer? |
71 // process_type: the type of NaCl process. | 75 // process_type: the type of NaCl process. |
72 // profile_directory: is the path of current profile directory. | 76 // profile_directory: is the path of current profile directory. |
73 NaClProcessHost( | 77 NaClProcessHost( |
74 const GURL& manifest_url, | 78 const GURL& manifest_url, |
75 base::File nexe_file, | 79 base::File nexe_file, |
76 const NaClFileToken& nexe_token, | 80 const NaClFileToken& nexe_token, |
77 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, | 81 const std::vector<NaClResourcePrefetchResult>& prefetched_resource_files, |
78 ppapi::PpapiPermissions permissions, | 82 ppapi::PpapiPermissions permissions, |
79 int render_view_id, | 83 int render_view_id, |
80 uint32 permission_bits, | 84 uint32_t permission_bits, |
81 bool uses_nonsfi_mode, | 85 bool uses_nonsfi_mode, |
82 bool off_the_record, | 86 bool off_the_record, |
83 NaClAppProcessType process_type, | 87 NaClAppProcessType process_type, |
84 const base::FilePath& profile_directory); | 88 const base::FilePath& profile_directory); |
85 ~NaClProcessHost() override; | 89 ~NaClProcessHost() override; |
86 | 90 |
87 void OnProcessCrashed(int exit_status) override; | 91 void OnProcessCrashed(int exit_status) override; |
88 | 92 |
89 // Do any minimal work that must be done at browser startup. | 93 // Do any minimal work that must be done at browser startup. |
90 static void EarlyStartup(); | 94 static void EarlyStartup(); |
91 | 95 |
92 // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. | 96 // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. |
93 static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds); | 97 static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds); |
94 | 98 |
95 // Initialize the new NaCl process. Result is returned by sending ipc | 99 // Initialize the new NaCl process. Result is returned by sending ipc |
96 // message reply_msg. | 100 // message reply_msg. |
97 void Launch(NaClHostMessageFilter* nacl_host_message_filter, | 101 void Launch(NaClHostMessageFilter* nacl_host_message_filter, |
98 IPC::Message* reply_msg, | 102 IPC::Message* reply_msg, |
99 const base::FilePath& manifest_path); | 103 const base::FilePath& manifest_path); |
100 | 104 |
101 void OnChannelConnected(int32 peer_pid) override; | 105 void OnChannelConnected(int32_t peer_pid) override; |
102 | 106 |
103 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
104 void OnProcessLaunchedByBroker(base::ProcessHandle handle); | 108 void OnProcessLaunchedByBroker(base::ProcessHandle handle); |
105 void OnDebugExceptionHandlerLaunchedByBroker(bool success); | 109 void OnDebugExceptionHandlerLaunchedByBroker(bool success); |
106 #endif | 110 #endif |
107 | 111 |
108 bool Send(IPC::Message* msg); | 112 bool Send(IPC::Message* msg); |
109 | 113 |
110 content::BrowserChildProcessHost* process() { return process_.get(); } | 114 content::BrowserChildProcessHost* process() { return process_.get(); } |
111 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } | 115 content::BrowserPpapiHost* browser_ppapi_host() { return ppapi_host_.get(); } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 178 |
175 // Does post-process-launching tasks for starting the NaCl process once | 179 // Does post-process-launching tasks for starting the NaCl process once |
176 // we have a connection. | 180 // we have a connection. |
177 // | 181 // |
178 // Returns false on failure. | 182 // Returns false on failure. |
179 bool StartWithLaunchedProcess(); | 183 bool StartWithLaunchedProcess(); |
180 | 184 |
181 // Message handlers for validation caching. | 185 // Message handlers for validation caching. |
182 void OnQueryKnownToValidate(const std::string& signature, bool* result); | 186 void OnQueryKnownToValidate(const std::string& signature, bool* result); |
183 void OnSetKnownToValidate(const std::string& signature); | 187 void OnSetKnownToValidate(const std::string& signature); |
184 void OnResolveFileToken(uint64 file_token_lo, uint64 file_token_hi); | 188 void OnResolveFileToken(uint64_t file_token_lo, uint64_t file_token_hi); |
185 void FileResolved(uint64_t file_token_lo, | 189 void FileResolved(uint64_t file_token_lo, |
186 uint64_t file_token_hi, | 190 uint64_t file_token_hi, |
187 const base::FilePath& file_path, | 191 const base::FilePath& file_path, |
188 base::File file); | 192 base::File file); |
189 #if defined(OS_WIN) | 193 #if defined(OS_WIN) |
190 // Message handler for Windows hardware exception handling. | 194 // Message handler for Windows hardware exception handling. |
191 void OnAttachDebugExceptionHandler(const std::string& info, | 195 void OnAttachDebugExceptionHandler(const std::string& info, |
192 IPC::Message* reply_msg); | 196 IPC::Message* reply_msg); |
193 bool AttachDebugExceptionHandler(const std::string& info, | 197 bool AttachDebugExceptionHandler(const std::string& info, |
194 IPC::Message* reply_msg); | 198 IPC::Message* reply_msg); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 base::File socket_for_sel_ldr_; | 264 base::File socket_for_sel_ldr_; |
261 | 265 |
262 base::WeakPtrFactory<NaClProcessHost> weak_factory_; | 266 base::WeakPtrFactory<NaClProcessHost> weak_factory_; |
263 | 267 |
264 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); | 268 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); |
265 }; | 269 }; |
266 | 270 |
267 } // namespace nacl | 271 } // namespace nacl |
268 | 272 |
269 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ | 273 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ |
OLD | NEW |