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

Side by Side Diff: components/nacl/common/nacl_types.h

Issue 1085583005: Refactor params of NaClProcessMsg_Start. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_COMMON_NACL_TYPES_H_ 5 #ifndef COMPONENTS_NACL_COMMON_NACL_TYPES_H_
6 #define COMPONENTS_NACL_COMMON_NACL_TYPES_H_ 6 #define COMPONENTS_NACL_COMMON_NACL_TYPES_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "base/process/process_handle.h" 14 #include "base/process/process_handle.h"
15 #include "base/strings/string_split.h"
16 #include "build/build_config.h" 15 #include "build/build_config.h"
17 #include "ipc/ipc_channel.h" 16 #include "ipc/ipc_channel.h"
18 #include "ipc/ipc_platform_file.h" 17 #include "ipc/ipc_platform_file.h"
19 18
20 #if defined(OS_POSIX) 19 #if defined(OS_POSIX)
21 #include "base/file_descriptor_posix.h" 20 #include "base/file_descriptor_posix.h"
22 #endif 21 #endif
23 22
24 #if defined(OS_WIN) 23 #if defined(OS_WIN)
25 #include <windows.h> // for HANDLE 24 #include <windows.h> // for HANDLE
(...skipping 26 matching lines...) Expand all
52 kNativeNaClProcessType, 51 kNativeNaClProcessType,
53 // Runs user-provided code that is translated from *bitcode* by an 52 // Runs user-provided code that is translated from *bitcode* by an
54 // in-browser PNaCl translator. 53 // in-browser PNaCl translator.
55 kPNaClProcessType, 54 kPNaClProcessType,
56 // Runs pnacl-llc/linker *native* code. These nexes are browser-provided 55 // Runs pnacl-llc/linker *native* code. These nexes are browser-provided
57 // (not user-provided). 56 // (not user-provided).
58 kPNaClTranslatorProcessType, 57 kPNaClTranslatorProcessType,
59 kNumNaClProcessTypes 58 kNumNaClProcessTypes
60 }; 59 };
61 60
61 // Represents a request to prefetch a file that's listed in the "files" section
62 // of a NaCl manifest file.
63 struct NaClResourcePrefetchRequest {
64 NaClResourcePrefetchRequest();
65 NaClResourcePrefetchRequest(const std::string& file_key,
66 const std::string& resource_url);
67 ~NaClResourcePrefetchRequest();
68
69 std::string file_key; // a key for open_resource.
70 std::string resource_url;
71 };
72
62 // Represents a single prefetched file that's listed in the "files" section of 73 // Represents a single prefetched file that's listed in the "files" section of
63 // a NaCl manifest file. 74 // a NaCl manifest file.
64 struct NaClResourceFileInfo { 75 struct NaClResourcePrefetchResult {
65 NaClResourceFileInfo(); 76 NaClResourcePrefetchResult();
66 NaClResourceFileInfo(IPC::PlatformFileForTransit file, 77 NaClResourcePrefetchResult(IPC::PlatformFileForTransit file,
67 const base::FilePath& file_path, 78 const base::FilePath& file_path,
68 const std::string& file_key); 79 const std::string& file_key);
69 ~NaClResourceFileInfo(); 80 ~NaClResourcePrefetchResult();
70 81
71 IPC::PlatformFileForTransit file; 82 IPC::PlatformFileForTransit file;
72 base::FilePath file_path_metadata; // a key for validation caching 83 base::FilePath file_path_metadata; // a key for validation caching
73 std::string file_key; // a key for open_resource 84 std::string file_key; // a key for open_resource
74 }; 85 };
75 86
76 // Parameters sent to the NaCl process when we start it. 87 // Parameters sent to the NaCl process when we start it.
77 struct NaClStartParams { 88 struct NaClStartParams {
78 NaClStartParams(); 89 NaClStartParams();
79 ~NaClStartParams(); 90 ~NaClStartParams();
80 91
81 IPC::PlatformFileForTransit nexe_file; 92 IPC::PlatformFileForTransit nexe_file;
82 // Used only as a key for validation caching. 93 // Used only as a key for validation caching.
83 base::FilePath nexe_file_path_metadata; 94 base::FilePath nexe_file_path_metadata;
84 95
85 std::vector<NaClResourceFileInfo> prefetched_resource_files; 96 std::vector<NaClResourcePrefetchResult> prefetched_resource_files;
86 std::vector<FileDescriptor> handles; 97 IPC::PlatformFileForTransit imc_bootstrap_handle;
87 FileDescriptor debug_stub_server_bound_socket; 98 IPC::PlatformFileForTransit irt_handle;
99 #if defined(OS_MACOSX)
100 IPC::PlatformFileForTransit mac_shm_fd;
101 #endif
102 #if defined(OS_POSIX)
103 IPC::PlatformFileForTransit debug_stub_server_bound_socket;
104 #endif
88 105
89 bool validation_cache_enabled; 106 bool validation_cache_enabled;
90 std::string validation_cache_key; 107 std::string validation_cache_key;
91 // Chrome version string. Sending the version string over IPC avoids linkage 108 // Chrome version string. Sending the version string over IPC avoids linkage
92 // issues in cases where NaCl is not compiled into the main Chromium 109 // issues in cases where NaCl is not compiled into the main Chromium
93 // executable or DLL. 110 // executable or DLL.
94 std::string version; 111 std::string version;
95 112
96 bool enable_debug_stub; 113 bool enable_debug_stub;
97 bool enable_ipc_proxy; 114 bool enable_ipc_proxy;
98 115
99 NaClAppProcessType process_type; 116 NaClAppProcessType process_type;
100 117
101 // For NaCl <-> renderer crash information reporting. 118 // For NaCl <-> renderer crash information reporting.
102 base::SharedMemoryHandle crash_info_shmem_handle; 119 base::SharedMemoryHandle crash_info_shmem_handle;
103 120
104 // NOTE: Any new fields added here must also be added to the IPC 121 // NOTE: Any new fields added here must also be added to the IPC
105 // serialization in nacl_messages.h and (for POD fields) the constructor 122 // serialization in nacl_messages.h and (for POD fields) the constructor
106 // in nacl_types.cc. 123 // in nacl_types.cc.
107 }; 124 };
108 125
109 // Parameters sent to the browser process to have it launch a NaCl process. 126 // Parameters sent to the browser process to have it launch a NaCl process.
110 // 127 //
111 // If you change this, you will also need to update the IPC serialization in 128 // If you change this, you will also need to update the IPC serialization in
112 // nacl_host_messages.h. 129 // nacl_host_messages.h.
113 struct NaClLaunchParams { 130 struct NaClLaunchParams {
114 NaClLaunchParams(); 131 NaClLaunchParams();
115 NaClLaunchParams(const std::string& manifest_url, 132 NaClLaunchParams(
116 const IPC::PlatformFileForTransit& nexe_file, 133 const std::string& manifest_url,
117 uint64_t nexe_token_lo, 134 const IPC::PlatformFileForTransit& nexe_file,
118 uint64_t nexe_token_hi, 135 uint64_t nexe_token_lo,
119 // A pair of a manifest key and its resource URL. 136 uint64_t nexe_token_hi,
120 const base::StringPairs& resource_files_to_prefetch, 137 const std::vector<
121 int render_view_id, 138 NaClResourcePrefetchRequest>& resource_prefetch_request_list,
122 uint32 permission_bits, 139 int render_view_id,
123 bool uses_nonsfi_mode, 140 uint32 permission_bits,
124 NaClAppProcessType process_type); 141 bool uses_nonsfi_mode,
142 NaClAppProcessType process_type);
125 ~NaClLaunchParams(); 143 ~NaClLaunchParams();
126 144
127 std::string manifest_url; 145 std::string manifest_url;
128 // On Windows, the HANDLE passed here is valid in the renderer's context. 146 // On Windows, the HANDLE passed here is valid in the renderer's context.
129 // It's the responsibility of the browser to duplicate this handle properly 147 // It's the responsibility of the browser to duplicate this handle properly
130 // for passing it to the plugin. 148 // for passing it to the plugin.
131 IPC::PlatformFileForTransit nexe_file; 149 IPC::PlatformFileForTransit nexe_file;
132 uint64_t nexe_token_lo; 150 uint64_t nexe_token_lo;
133 uint64_t nexe_token_hi; 151 uint64_t nexe_token_hi;
134 base::StringPairs resource_files_to_prefetch; 152 std::vector<NaClResourcePrefetchRequest> resource_prefetch_request_list;
135 153
136 int render_view_id; 154 int render_view_id;
137 uint32 permission_bits; 155 uint32 permission_bits;
138 bool uses_nonsfi_mode; 156 bool uses_nonsfi_mode;
139 157
140 NaClAppProcessType process_type; 158 NaClAppProcessType process_type;
141 }; 159 };
142 160
143 struct NaClLaunchResult { 161 struct NaClLaunchResult {
144 NaClLaunchResult(); 162 NaClLaunchResult();
(...skipping 23 matching lines...) Expand all
168 base::ProcessId plugin_pid; 186 base::ProcessId plugin_pid;
169 int plugin_child_id; 187 int plugin_child_id;
170 188
171 // For NaCl <-> renderer crash information reporting. 189 // For NaCl <-> renderer crash information reporting.
172 base::SharedMemoryHandle crash_info_shmem_handle; 190 base::SharedMemoryHandle crash_info_shmem_handle;
173 }; 191 };
174 192
175 } // namespace nacl 193 } // namespace nacl
176 194
177 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ 195 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698