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, |
| 70 const std::string& file_key); |
| 71 ~ResourceFileInfo(); |
| 72 |
| 73 IPC::PlatformFileForTransit file; |
| 74 base::FilePath file_path; |
| 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 // This corresponds to a key in the "files" section of the NMF file. |
| 137 std::string file_key; |
| 138 }; |
| 139 |
108 std::string manifest_url; | 140 std::string manifest_url; |
109 // On Windows, the HANDLE passed here is valid in the renderer's context. | 141 // 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 | 142 // It's the responsibility of the browser to duplicate this handle properly |
111 // for passing it to the plugin. | 143 // for passing it to the plugin. |
112 IPC::PlatformFileForTransit nexe_file; | 144 IPC::PlatformFileForTransit nexe_file; |
113 uint64_t nexe_token_lo; | 145 uint64_t nexe_token_lo; |
114 uint64_t nexe_token_hi; | 146 uint64_t nexe_token_hi; |
| 147 std::vector<ResourceFileInfo> resource_files_info; |
115 | 148 |
116 int render_view_id; | 149 int render_view_id; |
117 uint32 permission_bits; | 150 uint32 permission_bits; |
118 bool uses_nonsfi_mode; | 151 bool uses_nonsfi_mode; |
119 | 152 |
120 NaClAppProcessType process_type; | 153 NaClAppProcessType process_type; |
121 }; | 154 }; |
122 | 155 |
123 struct NaClLaunchResult { | 156 struct NaClLaunchResult { |
124 NaClLaunchResult(); | 157 NaClLaunchResult(); |
(...skipping 20 matching lines...) Expand all Loading... |
145 // For plugin <-> renderer ManifestService communication. | 178 // For plugin <-> renderer ManifestService communication. |
146 IPC::ChannelHandle manifest_service_ipc_channel_handle; | 179 IPC::ChannelHandle manifest_service_ipc_channel_handle; |
147 | 180 |
148 base::ProcessId plugin_pid; | 181 base::ProcessId plugin_pid; |
149 int plugin_child_id; | 182 int plugin_child_id; |
150 | 183 |
151 // For NaCl <-> renderer crash information reporting. | 184 // For NaCl <-> renderer crash information reporting. |
152 base::SharedMemoryHandle crash_info_shmem_handle; | 185 base::SharedMemoryHandle crash_info_shmem_handle; |
153 }; | 186 }; |
154 | 187 |
| 188 struct NaClOpenExecutableResult { |
| 189 struct FileInfo; |
| 190 NaClOpenExecutableResult(); |
| 191 NaClOpenExecutableResult(const FileInfo& file_info, |
| 192 const std::vector<FileInfo>& resource_files_info); |
| 193 ~NaClOpenExecutableResult(); |
| 194 |
| 195 struct FileInfo { |
| 196 FileInfo(); |
| 197 FileInfo(IPC::PlatformFileForTransit file, |
| 198 uint64_t file_token_lo, |
| 199 uint64_t file_token_hi); |
| 200 ~FileInfo(); |
| 201 |
| 202 IPC::PlatformFileForTransit file; |
| 203 uint64_t file_token_lo; |
| 204 uint64_t file_token_hi; |
| 205 }; |
| 206 |
| 207 FileInfo file_info; |
| 208 std::vector<FileInfo> resource_files_info; |
| 209 }; |
| 210 |
155 } // namespace nacl | 211 } // namespace nacl |
156 | 212 |
157 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 213 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
OLD | NEW |