| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 kNativeNaClProcessType, | 51 kNativeNaClProcessType, |
| 51 // Runs user-provided code that is translated from *bitcode* by an | 52 // Runs user-provided code that is translated from *bitcode* by an |
| 52 // in-browser PNaCl translator. | 53 // in-browser PNaCl translator. |
| 53 kPNaClProcessType, | 54 kPNaClProcessType, |
| 54 // Runs pnacl-llc/linker *native* code. These nexes are browser-provided | 55 // Runs pnacl-llc/linker *native* code. These nexes are browser-provided |
| 55 // (not user-provided). | 56 // (not user-provided). |
| 56 kPNaClTranslatorProcessType, | 57 kPNaClTranslatorProcessType, |
| 57 kNumNaClProcessTypes | 58 kNumNaClProcessTypes |
| 58 }; | 59 }; |
| 59 | 60 |
| 61 // Represents a single prefetched file that's listed in the "files" section of |
| 62 // a NaCl manifest file. |
| 63 struct NaClResourceFileInfo { |
| 64 NaClResourceFileInfo(); |
| 65 NaClResourceFileInfo(IPC::PlatformFileForTransit file, |
| 66 const base::FilePath& file_path, |
| 67 const std::string& file_key); |
| 68 ~NaClResourceFileInfo(); |
| 69 |
| 70 IPC::PlatformFileForTransit file; |
| 71 base::FilePath file_path_metadata; // a key for validation caching |
| 72 std::string file_key; // a key for open_resource |
| 73 }; |
| 74 |
| 60 // Parameters sent to the NaCl process when we start it. | 75 // Parameters sent to the NaCl process when we start it. |
| 61 struct NaClStartParams { | 76 struct NaClStartParams { |
| 62 NaClStartParams(); | 77 NaClStartParams(); |
| 63 ~NaClStartParams(); | 78 ~NaClStartParams(); |
| 64 | 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<NaClResourceFileInfo> prefetched_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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 // serialization in nacl_messages.h and (for POD fields) the constructor | 107 // serialization in nacl_messages.h and (for POD fields) the constructor |
| 92 // in nacl_types.cc. | 108 // in nacl_types.cc. |
| 93 }; | 109 }; |
| 94 | 110 |
| 95 // Parameters sent to the browser process to have it launch a NaCl process. | 111 // Parameters sent to the browser process to have it launch a NaCl process. |
| 96 // | 112 // |
| 97 // If you change this, you will also need to update the IPC serialization in | 113 // If you change this, you will also need to update the IPC serialization in |
| 98 // nacl_host_messages.h. | 114 // nacl_host_messages.h. |
| 99 struct NaClLaunchParams { | 115 struct NaClLaunchParams { |
| 100 NaClLaunchParams(); | 116 NaClLaunchParams(); |
| 101 NaClLaunchParams(const std::string& manifest_url, | 117 NaClLaunchParams( |
| 102 const IPC::PlatformFileForTransit& nexe_file, | 118 const std::string& manifest_url, |
| 103 uint64_t nexe_token_lo, | 119 const IPC::PlatformFileForTransit& nexe_file, |
| 104 uint64_t nexe_token_hi, | 120 uint64_t nexe_token_lo, |
| 105 int render_view_id, | 121 uint64_t nexe_token_hi, |
| 106 uint32 permission_bits, | 122 // A pair of a manifest key and its resource URL. |
| 107 bool uses_nonsfi_mode, | 123 const std::vector< |
| 108 NaClAppProcessType process_type); | 124 std::pair<std::string, std::string> >& resource_files_to_prefetch, |
| 125 int render_view_id, |
| 126 uint32 permission_bits, |
| 127 bool uses_nonsfi_mode, |
| 128 NaClAppProcessType process_type); |
| 109 ~NaClLaunchParams(); | 129 ~NaClLaunchParams(); |
| 110 | 130 |
| 111 std::string manifest_url; | 131 std::string manifest_url; |
| 112 // On Windows, the HANDLE passed here is valid in the renderer's context. | 132 // 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 | 133 // It's the responsibility of the browser to duplicate this handle properly |
| 114 // for passing it to the plugin. | 134 // for passing it to the plugin. |
| 115 IPC::PlatformFileForTransit nexe_file; | 135 IPC::PlatformFileForTransit nexe_file; |
| 116 uint64_t nexe_token_lo; | 136 uint64_t nexe_token_lo; |
| 117 uint64_t nexe_token_hi; | 137 uint64_t nexe_token_hi; |
| 138 std::vector<std::pair<std::string, std::string> > resource_files_to_prefetch; |
| 118 | 139 |
| 119 int render_view_id; | 140 int render_view_id; |
| 120 uint32 permission_bits; | 141 uint32 permission_bits; |
| 121 bool uses_nonsfi_mode; | 142 bool uses_nonsfi_mode; |
| 122 | 143 |
| 123 NaClAppProcessType process_type; | 144 NaClAppProcessType process_type; |
| 124 }; | 145 }; |
| 125 | 146 |
| 126 struct NaClLaunchResult { | 147 struct NaClLaunchResult { |
| 127 NaClLaunchResult(); | 148 NaClLaunchResult(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 151 base::ProcessId plugin_pid; | 172 base::ProcessId plugin_pid; |
| 152 int plugin_child_id; | 173 int plugin_child_id; |
| 153 | 174 |
| 154 // For NaCl <-> renderer crash information reporting. | 175 // For NaCl <-> renderer crash information reporting. |
| 155 base::SharedMemoryHandle crash_info_shmem_handle; | 176 base::SharedMemoryHandle crash_info_shmem_handle; |
| 156 }; | 177 }; |
| 157 | 178 |
| 158 } // namespace nacl | 179 } // namespace nacl |
| 159 | 180 |
| 160 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 181 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
| OLD | NEW |