Chromium Code Reviews| 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 { | |
|
hidehiko
2015/01/28 09:05:19
Move above?
http://google-styleguide.googlecode.co
Yusuke Sato
2015/02/04 02:00:28
Done. Let me keep this inside the class to avoid n
| |
| 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 | |
| 78 void CheckNumOfDescriptors(); | |
| 79 | |
| 65 IPC::PlatformFileForTransit nexe_file; | 80 IPC::PlatformFileForTransit nexe_file; |
| 66 // Used only as a key for validation caching. | 81 // Used only as a key for validation caching. |
| 67 base::FilePath nexe_file_path_metadata; | 82 base::FilePath nexe_file_path_metadata; |
| 68 | 83 |
| 84 std::vector<ResourceFileInfo> resource_files; | |
| 69 std::vector<FileDescriptor> handles; | 85 std::vector<FileDescriptor> handles; |
| 70 FileDescriptor debug_stub_server_bound_socket; | 86 FileDescriptor debug_stub_server_bound_socket; |
| 71 | 87 |
| 72 bool validation_cache_enabled; | 88 bool validation_cache_enabled; |
| 73 std::string validation_cache_key; | 89 std::string validation_cache_key; |
| 74 // Chrome version string. Sending the version string over IPC avoids linkage | 90 // Chrome version string. Sending the version string over IPC avoids linkage |
| 75 // issues in cases where NaCl is not compiled into the main Chromium | 91 // issues in cases where NaCl is not compiled into the main Chromium |
| 76 // executable or DLL. | 92 // executable or DLL. |
| 77 std::string version; | 93 std::string version; |
| 78 | 94 |
| 79 bool enable_debug_stub; | 95 bool enable_debug_stub; |
| 80 bool enable_ipc_proxy; | 96 bool enable_ipc_proxy; |
| 81 | 97 |
| 82 NaClAppProcessType process_type; | 98 NaClAppProcessType process_type; |
| 83 | 99 |
| 84 // For NaCl <-> renderer crash information reporting. | 100 // For NaCl <-> renderer crash information reporting. |
| 85 base::SharedMemoryHandle crash_info_shmem_handle; | 101 base::SharedMemoryHandle crash_info_shmem_handle; |
| 86 | 102 |
| 87 // NOTE: Any new fields added here must also be added to the IPC | 103 // 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 | 104 // serialization in nacl_messages.h and (for POD fields) the constructor |
| 89 // in nacl_types.cc. | 105 // in nacl_types.cc. Any new fields added for passing file handles must |
| 106 // also be checked in NaClStartParams::CheckNumOfDescriptors(). | |
| 90 }; | 107 }; |
| 91 | 108 |
| 92 // Parameters sent to the browser process to have it launch a NaCl process. | 109 // Parameters sent to the browser process to have it launch a NaCl process. |
| 93 // | 110 // |
| 94 // If you change this, you will also need to update the IPC serialization in | 111 // If you change this, you will also need to update the IPC serialization in |
| 95 // nacl_host_messages.h. | 112 // nacl_host_messages.h. |
| 96 struct NaClLaunchParams { | 113 struct NaClLaunchParams { |
| 114 struct ResourceFileInfo; | |
| 97 NaClLaunchParams(); | 115 NaClLaunchParams(); |
| 98 NaClLaunchParams(const std::string& manifest_url, | 116 NaClLaunchParams( |
| 99 const IPC::PlatformFileForTransit& nexe_file, | 117 const std::string& manifest_url, |
| 100 uint64_t nexe_token_lo, | 118 const IPC::PlatformFileForTransit& nexe_file, |
| 101 uint64_t nexe_token_hi, | 119 uint64_t nexe_token_lo, |
| 102 int render_view_id, | 120 uint64_t nexe_token_hi, |
| 103 uint32 permission_bits, | 121 const std::vector<ResourceFileInfo>& resource_files, |
| 104 bool uses_nonsfi_mode, | 122 int render_view_id, |
| 105 NaClAppProcessType process_type); | 123 uint32 permission_bits, |
| 124 bool uses_nonsfi_mode, | |
| 125 NaClAppProcessType process_type); | |
| 106 ~NaClLaunchParams(); | 126 ~NaClLaunchParams(); |
| 107 | 127 |
| 128 struct ResourceFileInfo { | |
|
hidehiko
2015/01/28 09:05:19
Move to above?
http://google-styleguide.googlecod
Yusuke Sato
2015/02/04 02:00:28
Done.
| |
| 129 ResourceFileInfo(); | |
| 130 ResourceFileInfo(IPC::PlatformFileForTransit file, | |
| 131 uint64_t file_token_lo, | |
| 132 uint64_t file_token_hi, | |
| 133 const std::string& file_key); | |
| 134 ~ResourceFileInfo(); | |
| 135 | |
| 136 IPC::PlatformFileForTransit file; | |
|
hidehiko
2015/01/28 09:05:19
These three fields looks as same as NaClOpenExecut
Yusuke Sato
2015/02/04 02:00:28
Done.
| |
| 137 uint64_t file_token_lo; | |
| 138 uint64_t file_token_hi; | |
| 139 // This corresponds to a key in the "files" section of the NMF file. | |
| 140 std::string file_key; | |
| 141 }; | |
| 142 | |
| 108 std::string manifest_url; | 143 std::string manifest_url; |
| 109 // On Windows, the HANDLE passed here is valid in the renderer's context. | 144 // 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 | 145 // It's the responsibility of the browser to duplicate this handle properly |
| 111 // for passing it to the plugin. | 146 // for passing it to the plugin. |
| 112 IPC::PlatformFileForTransit nexe_file; | 147 IPC::PlatformFileForTransit nexe_file; |
| 113 uint64_t nexe_token_lo; | 148 uint64_t nexe_token_lo; |
| 114 uint64_t nexe_token_hi; | 149 uint64_t nexe_token_hi; |
| 150 std::vector<ResourceFileInfo> resource_files_info; | |
| 115 | 151 |
| 116 int render_view_id; | 152 int render_view_id; |
| 117 uint32 permission_bits; | 153 uint32 permission_bits; |
| 118 bool uses_nonsfi_mode; | 154 bool uses_nonsfi_mode; |
| 119 | 155 |
| 120 NaClAppProcessType process_type; | 156 NaClAppProcessType process_type; |
| 121 }; | 157 }; |
| 122 | 158 |
| 123 struct NaClLaunchResult { | 159 struct NaClLaunchResult { |
| 124 NaClLaunchResult(); | 160 NaClLaunchResult(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 145 // For plugin <-> renderer ManifestService communication. | 181 // For plugin <-> renderer ManifestService communication. |
| 146 IPC::ChannelHandle manifest_service_ipc_channel_handle; | 182 IPC::ChannelHandle manifest_service_ipc_channel_handle; |
| 147 | 183 |
| 148 base::ProcessId plugin_pid; | 184 base::ProcessId plugin_pid; |
| 149 int plugin_child_id; | 185 int plugin_child_id; |
| 150 | 186 |
| 151 // For NaCl <-> renderer crash information reporting. | 187 // For NaCl <-> renderer crash information reporting. |
| 152 base::SharedMemoryHandle crash_info_shmem_handle; | 188 base::SharedMemoryHandle crash_info_shmem_handle; |
| 153 }; | 189 }; |
| 154 | 190 |
| 191 struct NaClOpenExecutableResult { | |
| 192 struct FileInfo; | |
| 193 NaClOpenExecutableResult(); | |
| 194 NaClOpenExecutableResult(const FileInfo& file_info, | |
| 195 const std::vector<FileInfo>& resource_files_info); | |
| 196 ~NaClOpenExecutableResult(); | |
| 197 | |
| 198 struct FileInfo { | |
| 199 FileInfo(); | |
| 200 FileInfo(IPC::PlatformFileForTransit file, | |
| 201 uint64_t file_token_lo, | |
| 202 uint64_t file_token_hi); | |
| 203 ~FileInfo(); | |
| 204 | |
| 205 IPC::PlatformFileForTransit file; | |
| 206 uint64_t file_token_lo; | |
| 207 uint64_t file_token_hi; | |
| 208 }; | |
| 209 | |
| 210 FileInfo file_info; | |
| 211 std::vector<FileInfo> resource_files_info; | |
| 212 }; | |
| 213 | |
| 155 } // namespace nacl | 214 } // namespace nacl |
| 156 | 215 |
| 157 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 216 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
| OLD | NEW |