OLD | NEW |
---|---|
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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 kNativeNaClProcessType, | 50 kNativeNaClProcessType, |
51 // Runs user-provided code that is translated from *bitcode* by an | 51 // Runs user-provided code that is translated from *bitcode* by an |
52 // in-browser PNaCl translator. | 52 // in-browser PNaCl translator. |
53 kPNaClProcessType, | 53 kPNaClProcessType, |
54 // Runs pnacl-llc/linker *native* code. These nexes are browser-provided | 54 // Runs pnacl-llc/linker *native* code. These nexes are browser-provided |
55 // (not user-provided). | 55 // (not user-provided). |
56 kPNaClTranslatorProcessType, | 56 kPNaClTranslatorProcessType, |
57 kNumNaClProcessTypes | 57 kNumNaClProcessTypes |
58 }; | 58 }; |
59 | 59 |
60 struct NaClResourceFileInfo { | |
61 NaClResourceFileInfo(); | |
62 NaClResourceFileInfo(IPC::PlatformFileForTransit file, | |
63 uint64_t file_token_lo, | |
64 uint64_t file_token_hi); | |
65 NaClResourceFileInfo(IPC::PlatformFileForTransit file, | |
66 uint64_t file_token_lo, | |
67 uint64_t file_token_hi, | |
68 const std::string& key); | |
69 ~NaClResourceFileInfo(); | |
70 | |
71 IPC::PlatformFileForTransit file; | |
72 uint64_t file_token_lo; | |
Mark Seaborn
2015/02/12 03:57:33
Could you use NaClFileToken instead of two uint64_
Yusuke Sato
2015/02/13 23:01:17
Done (removed the class)
| |
73 uint64_t file_token_hi; | |
74 std::string key; // a key for open_resource | |
75 }; | |
76 | |
60 // Parameters sent to the NaCl process when we start it. | 77 // Parameters sent to the NaCl process when we start it. |
61 struct NaClStartParams { | 78 struct NaClStartParams { |
79 struct ResourceFileInfo { | |
80 ResourceFileInfo(); | |
81 ResourceFileInfo(IPC::PlatformFileForTransit file, | |
82 const base::FilePath& file_path, | |
83 const std::string& file_key); | |
84 ~ResourceFileInfo(); | |
85 | |
86 IPC::PlatformFileForTransit file; | |
87 base::FilePath file_path; // a key for validation caching | |
88 std::string file_key; // a key for open_resource | |
89 }; | |
90 | |
62 NaClStartParams(); | 91 NaClStartParams(); |
63 ~NaClStartParams(); | 92 ~NaClStartParams(); |
64 | 93 |
94 void CheckNumOfDescriptors(); | |
95 | |
65 IPC::PlatformFileForTransit nexe_file; | 96 IPC::PlatformFileForTransit nexe_file; |
66 // Used only as a key for validation caching. | 97 // Used only as a key for validation caching. |
67 base::FilePath nexe_file_path_metadata; | 98 base::FilePath nexe_file_path_metadata; |
68 | 99 |
100 std::vector<ResourceFileInfo> resource_files; | |
Mark Seaborn
2015/02/12 03:57:33
How about "prefetched_resource_files"?
There are
Yusuke Sato
2015/02/13 23:01:16
Done.
| |
69 std::vector<FileDescriptor> handles; | 101 std::vector<FileDescriptor> handles; |
70 FileDescriptor debug_stub_server_bound_socket; | 102 FileDescriptor debug_stub_server_bound_socket; |
71 | 103 |
72 bool validation_cache_enabled; | 104 bool validation_cache_enabled; |
73 std::string validation_cache_key; | 105 std::string validation_cache_key; |
74 // Chrome version string. Sending the version string over IPC avoids linkage | 106 // Chrome version string. Sending the version string over IPC avoids linkage |
75 // issues in cases where NaCl is not compiled into the main Chromium | 107 // issues in cases where NaCl is not compiled into the main Chromium |
76 // executable or DLL. | 108 // executable or DLL. |
77 std::string version; | 109 std::string version; |
78 | 110 |
79 bool enable_debug_stub; | 111 bool enable_debug_stub; |
80 bool enable_ipc_proxy; | 112 bool enable_ipc_proxy; |
81 | 113 |
82 // Enables plugin code to use Mojo APIs. See mojo/nacl for details. | 114 // Enables plugin code to use Mojo APIs. See mojo/nacl for details. |
83 bool enable_mojo; | 115 bool enable_mojo; |
84 | 116 |
85 NaClAppProcessType process_type; | 117 NaClAppProcessType process_type; |
86 | 118 |
87 // For NaCl <-> renderer crash information reporting. | 119 // For NaCl <-> renderer crash information reporting. |
88 base::SharedMemoryHandle crash_info_shmem_handle; | 120 base::SharedMemoryHandle crash_info_shmem_handle; |
89 | 121 |
90 // NOTE: Any new fields added here must also be added to the IPC | 122 // NOTE: Any new fields added here must also be added to the IPC |
91 // serialization in nacl_messages.h and (for POD fields) the constructor | 123 // serialization in nacl_messages.h and (for POD fields) the constructor |
92 // in nacl_types.cc. | 124 // in nacl_types.cc. Any new fields added for passing file handles must |
125 // also be checked in NaClStartParams::CheckNumOfDescriptors(). | |
93 }; | 126 }; |
94 | 127 |
95 // Parameters sent to the browser process to have it launch a NaCl process. | 128 // Parameters sent to the browser process to have it launch a NaCl process. |
96 // | 129 // |
97 // If you change this, you will also need to update the IPC serialization in | 130 // If you change this, you will also need to update the IPC serialization in |
98 // nacl_host_messages.h. | 131 // nacl_host_messages.h. |
99 struct NaClLaunchParams { | 132 struct NaClLaunchParams { |
100 NaClLaunchParams(); | 133 NaClLaunchParams(); |
101 NaClLaunchParams(const std::string& manifest_url, | 134 NaClLaunchParams( |
102 const IPC::PlatformFileForTransit& nexe_file, | 135 const std::string& manifest_url, |
103 uint64_t nexe_token_lo, | 136 const IPC::PlatformFileForTransit& nexe_file, |
104 uint64_t nexe_token_hi, | 137 uint64_t nexe_token_lo, |
105 int render_view_id, | 138 uint64_t nexe_token_hi, |
106 uint32 permission_bits, | 139 const std::vector<NaClResourceFileInfo>& resource_files, |
107 bool uses_nonsfi_mode, | 140 int render_view_id, |
108 NaClAppProcessType process_type); | 141 uint32 permission_bits, |
142 bool uses_nonsfi_mode, | |
143 NaClAppProcessType process_type); | |
109 ~NaClLaunchParams(); | 144 ~NaClLaunchParams(); |
110 | 145 |
111 std::string manifest_url; | 146 std::string manifest_url; |
112 // On Windows, the HANDLE passed here is valid in the renderer's context. | 147 // On Windows, the HANDLE passed here is valid in the renderer's context. |
113 // It's the responsibility of the browser to duplicate this handle properly | 148 // It's the responsibility of the browser to duplicate this handle properly |
114 // for passing it to the plugin. | 149 // for passing it to the plugin. |
115 IPC::PlatformFileForTransit nexe_file; | 150 IPC::PlatformFileForTransit nexe_file; |
116 uint64_t nexe_token_lo; | 151 uint64_t nexe_token_lo; |
117 uint64_t nexe_token_hi; | 152 uint64_t nexe_token_hi; |
153 std::vector<NaClResourceFileInfo> resource_files_info; | |
118 | 154 |
119 int render_view_id; | 155 int render_view_id; |
120 uint32 permission_bits; | 156 uint32 permission_bits; |
121 bool uses_nonsfi_mode; | 157 bool uses_nonsfi_mode; |
122 | 158 |
123 NaClAppProcessType process_type; | 159 NaClAppProcessType process_type; |
124 }; | 160 }; |
125 | 161 |
126 struct NaClLaunchResult { | 162 struct NaClLaunchResult { |
127 NaClLaunchResult(); | 163 NaClLaunchResult(); |
(...skipping 23 matching lines...) Expand all Loading... | |
151 base::ProcessId plugin_pid; | 187 base::ProcessId plugin_pid; |
152 int plugin_child_id; | 188 int plugin_child_id; |
153 | 189 |
154 // For NaCl <-> renderer crash information reporting. | 190 // For NaCl <-> renderer crash information reporting. |
155 base::SharedMemoryHandle crash_info_shmem_handle; | 191 base::SharedMemoryHandle crash_info_shmem_handle; |
156 }; | 192 }; |
157 | 193 |
158 } // namespace nacl | 194 } // namespace nacl |
159 | 195 |
160 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 196 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
OLD | NEW |