Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: components/nacl/browser/nacl_process_host.h

Issue 649603004: Non-SFI NaCl: Batch-open resource files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string>
11 #include <utility>
12 #include <vector>
13
10 #include "base/files/file.h" 14 #include "base/files/file.h"
11 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
12 #include "base/files/file_util_proxy.h" 16 #include "base/files/file_util_proxy.h"
13 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
14 #include "base/memory/shared_memory.h" 18 #include "base/memory/shared_memory.h"
15 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
16 #include "base/message_loop/message_loop.h" 20 #include "base/message_loop/message_loop.h"
17 #include "base/process/process.h" 21 #include "base/process/process.h"
18 #include "components/nacl/common/nacl_types.h" 22 #include "components/nacl/common/nacl_types.h"
19 #include "content/public/browser/browser_child_process_host_delegate.h" 23 #include "content/public/browser/browser_child_process_host_delegate.h"
(...skipping 11 matching lines...) Expand all
31 35
32 namespace IPC { 36 namespace IPC {
33 class ChannelProxy; 37 class ChannelProxy;
34 } 38 }
35 39
36 namespace nacl { 40 namespace nacl {
37 41
38 class NaClHostMessageFilter; 42 class NaClHostMessageFilter;
39 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size); 43 void* AllocateAddressSpaceASLR(base::ProcessHandle process, size_t size);
40 44
45 class ResourceFileInfo {
Mark Seaborn 2015/02/09 04:48:34 It's rather confusing that you have three Resource
Yusuke Sato 2015/02/11 05:54:20 I defined these structs to use exactly the same ty
46 MOVE_ONLY_TYPE_FOR_CPP_03(ResourceFileInfo, RValue);
47 public:
48 ResourceFileInfo();
49 ResourceFileInfo(base::File file,
50 const NaClFileToken& file_token,
51 const std::string& file_key);
52 ~ResourceFileInfo();
53
54 ResourceFileInfo(RValue other);
55 ResourceFileInfo& operator=(RValue other);
56
57 base::File file_;
Mark Seaborn 2015/02/09 04:48:34 Nit: If these are public, they shouldn't have a "_
Yusuke Sato 2015/02/11 05:54:20 Removed the class. Done.
58 NaClFileToken file_token_;
59 std::string file_key_;
60 };
61
41 // Represents the browser side of the browser <--> NaCl communication 62 // Represents the browser side of the browser <--> NaCl communication
42 // channel. There will be one NaClProcessHost per NaCl process 63 // channel. There will be one NaClProcessHost per NaCl process
43 // The browser is responsible for starting the NaCl process 64 // The browser is responsible for starting the NaCl process
44 // when requested by the renderer. 65 // when requested by the renderer.
45 // After that, most of the communication is directly between NaCl plugin 66 // After that, most of the communication is directly between NaCl plugin
46 // running in the renderer and NaCl processes. 67 // running in the renderer and NaCl processes.
47 class NaClProcessHost : public content::BrowserChildProcessHostDelegate { 68 class NaClProcessHost : public content::BrowserChildProcessHostDelegate {
48 public: 69 public:
49 // manifest_url: the URL of the manifest of the Native Client plugin being 70 // manifest_url: the URL of the manifest of the Native Client plugin being
50 // executed. 71 // executed.
51 // nexe_file: A file that corresponds to the nexe module to be loaded. 72 // nexe_file: A file that corresponds to the nexe module to be loaded.
52 // nexe_token: A cache validation token for nexe_file. 73 // nexe_token: A cache validation token for nexe_file.
53 // permissions: PPAPI permissions, to control access to private APIs. 74 // permissions: PPAPI permissions, to control access to private APIs.
54 // render_view_id: RenderView routing id, to control access to private APIs. 75 // render_view_id: RenderView routing id, to control access to private APIs.
55 // permission_bits: controls which interfaces the NaCl plugin can use. 76 // permission_bits: controls which interfaces the NaCl plugin can use.
56 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode. 77 // uses_nonsfi_mode: whether the program should be loaded under non-SFI mode.
57 // off_the_record: was the process launched from an incognito renderer? 78 // off_the_record: was the process launched from an incognito renderer?
58 // process_type: the type of NaCl process. 79 // process_type: the type of NaCl process.
59 // profile_directory: is the path of current profile directory. 80 // profile_directory: is the path of current profile directory.
60 NaClProcessHost(const GURL& manifest_url, 81 NaClProcessHost(
61 base::File nexe_file, 82 const GURL& manifest_url,
62 const NaClFileToken& nexe_token, 83 base::File nexe_file,
63 ppapi::PpapiPermissions permissions, 84 const NaClFileToken& nexe_token,
64 int render_view_id, 85 scoped_ptr<ResourceFileInfo[]> resource_files_info,
65 uint32 permission_bits, 86 size_t resource_files_info_len,
Mark Seaborn 2015/02/09 04:48:34 How about making resource_files_info a vector inst
Yusuke Sato 2015/02/11 05:54:20 It was difficult to do so for the move-only class,
66 bool uses_nonsfi_mode, 87 ppapi::PpapiPermissions permissions,
67 bool off_the_record, 88 int render_view_id,
68 NaClAppProcessType process_type, 89 uint32 permission_bits,
69 const base::FilePath& profile_directory); 90 bool uses_nonsfi_mode,
91 bool off_the_record,
92 NaClAppProcessType process_type,
93 const base::FilePath& profile_directory);
70 ~NaClProcessHost() override; 94 ~NaClProcessHost() override;
71 95
72 void OnProcessCrashed(int exit_status) override; 96 void OnProcessCrashed(int exit_status) override;
73 97
74 // Do any minimal work that must be done at browser startup. 98 // Do any minimal work that must be done at browser startup.
75 static void EarlyStartup(); 99 static void EarlyStartup();
76 100
77 // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs. 101 // Specifies throttling time in milliseconds for PpapiHostMsg_Keepalive IPCs.
78 static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds); 102 static void SetPpapiKeepAliveThrottleForTesting(unsigned milliseconds);
79 103
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 // created. 199 // created.
176 void OnPpapiChannelsCreated( 200 void OnPpapiChannelsCreated(
177 const IPC::ChannelHandle& browser_channel_handle, 201 const IPC::ChannelHandle& browser_channel_handle,
178 const IPC::ChannelHandle& ppapi_renderer_channel_handle, 202 const IPC::ChannelHandle& ppapi_renderer_channel_handle,
179 const IPC::ChannelHandle& trusted_renderer_channel_handle, 203 const IPC::ChannelHandle& trusted_renderer_channel_handle,
180 const IPC::ChannelHandle& manifest_service_channel_handle); 204 const IPC::ChannelHandle& manifest_service_channel_handle);
181 205
182 GURL manifest_url_; 206 GURL manifest_url_;
183 base::File nexe_file_; 207 base::File nexe_file_;
184 NaClFileToken nexe_token_; 208 NaClFileToken nexe_token_;
209 scoped_ptr<ResourceFileInfo[]> resource_files_info_;
210 size_t resource_files_info_len_;
185 211
186 ppapi::PpapiPermissions permissions_; 212 ppapi::PpapiPermissions permissions_;
187 213
188 #if defined(OS_WIN) 214 #if defined(OS_WIN)
189 // This field becomes true when the broker successfully launched 215 // This field becomes true when the broker successfully launched
190 // the NaCl loader. 216 // the NaCl loader.
191 bool process_launched_by_broker_; 217 bool process_launched_by_broker_;
192 #endif 218 #endif
193 // The NaClHostMessageFilter that requested this NaCl process. We use 219 // The NaClHostMessageFilter that requested this NaCl process. We use
194 // this for sending the reply once the process has started. 220 // this for sending the reply once the process has started.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 base::File socket_for_sel_ldr_; 262 base::File socket_for_sel_ldr_;
237 263
238 base::WeakPtrFactory<NaClProcessHost> weak_factory_; 264 base::WeakPtrFactory<NaClProcessHost> weak_factory_;
239 265
240 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost); 266 DISALLOW_COPY_AND_ASSIGN(NaClProcessHost);
241 }; 267 };
242 268
243 } // namespace nacl 269 } // namespace nacl
244 270
245 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_ 271 #endif // COMPONENTS_NACL_BROWSER_NACL_PROCESS_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698