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 <utility> | |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
13 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
15 #include "ipc/ipc_channel.h" | 16 #include "ipc/ipc_channel.h" |
16 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
17 | 18 |
18 #if defined(OS_POSIX) | 19 #if defined(OS_POSIX) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 // (not user-provided). | 56 // (not user-provided). |
56 kPNaClTranslatorProcessType, | 57 kPNaClTranslatorProcessType, |
57 kNumNaClProcessTypes | 58 kNumNaClProcessTypes |
58 }; | 59 }; |
59 | 60 |
60 // Parameters sent to the NaCl process when we start it. | 61 // Parameters sent to the NaCl process when we start it. |
61 struct NaClStartParams { | 62 struct NaClStartParams { |
62 NaClStartParams(); | 63 NaClStartParams(); |
63 ~NaClStartParams(); | 64 ~NaClStartParams(); |
64 | 65 |
66 struct ResourceFileInfo { | |
67 ResourceFileInfo(); | |
68 ResourceFileInfo(IPC::PlatformFileForTransit file, | |
69 const base::FilePath& file_path_metadata, | |
70 const std::string& file_key); | |
71 ~ResourceFileInfo(); | |
72 | |
73 IPC::PlatformFileForTransit file; | |
74 base::FilePath file_path_metadata; | |
teravest
2014/11/10 20:36:11
Documenting the intended use for file_path_metadat
Yusuke Sato
2014/11/11 00:58:35
Done.
I think I used the suffix to make the varia
| |
75 std::string file_key; | |
76 }; | |
77 | |
65 IPC::PlatformFileForTransit nexe_file; | 78 IPC::PlatformFileForTransit nexe_file; |
66 uint64_t nexe_token_lo; | 79 uint64_t nexe_token_lo; |
67 uint64_t nexe_token_hi; | 80 uint64_t nexe_token_hi; |
68 | 81 |
82 std::vector<ResourceFileInfo> resource_files; | |
69 std::vector<FileDescriptor> handles; | 83 std::vector<FileDescriptor> handles; |
70 FileDescriptor debug_stub_server_bound_socket; | 84 FileDescriptor debug_stub_server_bound_socket; |
71 | 85 |
72 bool validation_cache_enabled; | 86 bool validation_cache_enabled; |
73 std::string validation_cache_key; | 87 std::string validation_cache_key; |
74 // Chrome version string. Sending the version string over IPC avoids linkage | 88 // Chrome version string. Sending the version string over IPC avoids linkage |
75 // issues in cases where NaCl is not compiled into the main Chromium | 89 // issues in cases where NaCl is not compiled into the main Chromium |
76 // executable or DLL. | 90 // executable or DLL. |
77 std::string version; | 91 std::string version; |
78 | 92 |
79 bool enable_debug_stub; | 93 bool enable_debug_stub; |
80 bool enable_ipc_proxy; | 94 bool enable_ipc_proxy; |
81 | 95 |
82 NaClAppProcessType process_type; | 96 NaClAppProcessType process_type; |
83 | 97 |
84 // For NaCl <-> renderer crash information reporting. | 98 // For NaCl <-> renderer crash information reporting. |
85 base::SharedMemoryHandle crash_info_shmem_handle; | 99 base::SharedMemoryHandle crash_info_shmem_handle; |
86 | 100 |
87 // NOTE: Any new fields added here must also be added to the IPC | 101 // NOTE: Any new fields added here must also be added to the IPC |
88 // serialization in nacl_messages.h and (for POD fields) the constructor | 102 // serialization in nacl_messages.h and (for POD fields) the constructor |
89 // in nacl_types.cc. | 103 // in nacl_types.cc. |
90 }; | 104 }; |
91 | 105 |
92 // Parameters sent to the browser process to have it launch a NaCl process. | 106 // Parameters sent to the browser process to have it launch a NaCl process. |
93 // | 107 // |
94 // If you change this, you will also need to update the IPC serialization in | 108 // If you change this, you will also need to update the IPC serialization in |
95 // nacl_host_messages.h. | 109 // nacl_host_messages.h. |
96 struct NaClLaunchParams { | 110 struct NaClLaunchParams { |
111 struct ResourceFileInfo; | |
97 NaClLaunchParams(); | 112 NaClLaunchParams(); |
98 NaClLaunchParams(const std::string& manifest_url, | 113 NaClLaunchParams( |
99 const IPC::PlatformFileForTransit& nexe_file, | 114 const std::string& manifest_url, |
100 uint64_t nexe_token_lo, | 115 const IPC::PlatformFileForTransit& nexe_file, |
101 uint64_t nexe_token_hi, | 116 uint64_t nexe_token_lo, |
102 int render_view_id, | 117 uint64_t nexe_token_hi, |
103 uint32 permission_bits, | 118 const std::vector<ResourceFileInfo>& resource_files, |
104 bool uses_nonsfi_mode, | 119 int render_view_id, |
105 NaClAppProcessType process_type); | 120 uint32 permission_bits, |
121 bool uses_nonsfi_mode, | |
122 NaClAppProcessType process_type); | |
106 ~NaClLaunchParams(); | 123 ~NaClLaunchParams(); |
107 | 124 |
125 struct ResourceFileInfo { | |
126 ResourceFileInfo(); | |
127 ResourceFileInfo(IPC::PlatformFileForTransit file, | |
128 uint64_t file_token_lo, | |
129 uint64_t file_token_hi, | |
130 const std::string& file_key); | |
131 ~ResourceFileInfo(); | |
132 | |
133 IPC::PlatformFileForTransit file; | |
134 uint64_t file_token_lo; | |
135 uint64_t file_token_hi; | |
136 std::string file_key; | |
teravest
2014/11/10 20:36:11
I think it's worth adding a comment that file_key
Yusuke Sato
2014/11/11 00:58:35
Good idea. Done.
| |
137 }; | |
138 | |
108 std::string manifest_url; | 139 std::string manifest_url; |
109 // On Windows, the HANDLE passed here is valid in the renderer's context. | 140 // On Windows, the HANDLE passed here is valid in the renderer's context. |
110 // It's the responsibility of the browser to duplicate this handle properly | 141 // It's the responsibility of the browser to duplicate this handle properly |
111 // for passing it to the plugin. | 142 // for passing it to the plugin. |
112 IPC::PlatformFileForTransit nexe_file; | 143 IPC::PlatformFileForTransit nexe_file; |
113 uint64_t nexe_token_lo; | 144 uint64_t nexe_token_lo; |
114 uint64_t nexe_token_hi; | 145 uint64_t nexe_token_hi; |
146 std::vector<ResourceFileInfo> resource_files_info; | |
115 | 147 |
116 int render_view_id; | 148 int render_view_id; |
117 uint32 permission_bits; | 149 uint32 permission_bits; |
118 bool uses_nonsfi_mode; | 150 bool uses_nonsfi_mode; |
119 | 151 |
120 NaClAppProcessType process_type; | 152 NaClAppProcessType process_type; |
121 }; | 153 }; |
122 | 154 |
123 struct NaClLaunchResult { | 155 struct NaClLaunchResult { |
124 NaClLaunchResult(); | 156 NaClLaunchResult(); |
(...skipping 20 matching lines...) Expand all Loading... | |
145 // For plugin <-> renderer ManifestService communication. | 177 // For plugin <-> renderer ManifestService communication. |
146 IPC::ChannelHandle manifest_service_ipc_channel_handle; | 178 IPC::ChannelHandle manifest_service_ipc_channel_handle; |
147 | 179 |
148 base::ProcessId plugin_pid; | 180 base::ProcessId plugin_pid; |
149 int plugin_child_id; | 181 int plugin_child_id; |
150 | 182 |
151 // For NaCl <-> renderer crash information reporting. | 183 // For NaCl <-> renderer crash information reporting. |
152 base::SharedMemoryHandle crash_info_shmem_handle; | 184 base::SharedMemoryHandle crash_info_shmem_handle; |
153 }; | 185 }; |
154 | 186 |
187 struct NaClOpenExecutableResult { | |
188 struct FileInfo; | |
189 NaClOpenExecutableResult(); | |
190 NaClOpenExecutableResult(const FileInfo& file_info, | |
191 const std::vector<FileInfo>& resource_files_info); | |
192 ~NaClOpenExecutableResult(); | |
193 | |
194 struct FileInfo { | |
195 FileInfo(); | |
196 FileInfo(IPC::PlatformFileForTransit file, | |
197 uint64_t file_token_lo, | |
198 uint64_t file_token_hi); | |
199 ~FileInfo(); | |
200 | |
201 IPC::PlatformFileForTransit file; | |
202 uint64_t file_token_lo; | |
203 uint64_t file_token_hi; | |
204 }; | |
205 | |
206 FileInfo file_info; | |
207 std::vector<FileInfo> resource_files_info; | |
208 }; | |
209 | |
155 } // namespace nacl | 210 } // namespace nacl |
156 | 211 |
157 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 212 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
OLD | NEW |