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 <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "ipc/ipc_channel.h" | 16 #include "ipc/ipc_channel.h" |
| 17 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
| 18 | 18 |
| 19 #if defined(OS_POSIX) | |
| 20 #include "base/file_descriptor_posix.h" | |
| 21 #endif | |
| 22 | |
| 23 #if defined(OS_WIN) | |
| 24 #include <windows.h> // for HANDLE | |
| 25 #endif | |
| 26 | |
| 27 // TODO(gregoryd): add a Windows definition for base::FileDescriptor | 19 // TODO(gregoryd): add a Windows definition for base::FileDescriptor |
|
Mark Seaborn
2015/05/06 21:24:53
You can remove this comment too.
hidehiko
2015/05/07 01:29:07
Done.
| |
| 28 namespace nacl { | 20 namespace nacl { |
| 29 | 21 |
| 30 #if defined(OS_WIN) | |
| 31 typedef HANDLE FileDescriptor; | |
|
Mark Seaborn
2015/05/06 21:24:53
Thanks for removing this old stuff!
hidehiko
2015/05/07 01:29:07
Acknowledged.
| |
| 32 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { | |
| 33 return desc; | |
| 34 } | |
| 35 #elif defined(OS_POSIX) | |
| 36 typedef base::FileDescriptor FileDescriptor; | |
| 37 inline int ToNativeHandle(const FileDescriptor& desc) { | |
| 38 return desc.fd; | |
| 39 } | |
| 40 #endif | |
| 41 | |
| 42 // We allocate a page of shared memory for sharing crash information from | 22 // We allocate a page of shared memory for sharing crash information from |
| 43 // trusted code in the NaCl process to the renderer. | 23 // trusted code in the NaCl process to the renderer. |
| 44 static const int kNaClCrashInfoShmemSize = 4096; | 24 static const int kNaClCrashInfoShmemSize = 4096; |
| 45 static const int kNaClCrashInfoMaxLogSize = 1024; | 25 static const int kNaClCrashInfoMaxLogSize = 1024; |
| 46 | 26 |
| 47 // Types of untrusted NaCl processes. | 27 // Types of untrusted NaCl processes. |
| 48 enum NaClAppProcessType { | 28 enum NaClAppProcessType { |
| 49 kUnknownNaClProcessType, | 29 kUnknownNaClProcessType, |
| 50 // Runs user-provided *native* code. Enabled for Chrome Web Store apps. | 30 // Runs user-provided *native* code. Enabled for Chrome Web Store apps. |
| 51 kNativeNaClProcessType, | 31 kNativeNaClProcessType, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 67 ~NaClResourcePrefetchRequest(); | 47 ~NaClResourcePrefetchRequest(); |
| 68 | 48 |
| 69 std::string file_key; // a key for open_resource. | 49 std::string file_key; // a key for open_resource. |
| 70 std::string resource_url; | 50 std::string resource_url; |
| 71 }; | 51 }; |
| 72 | 52 |
| 73 // Represents a single prefetched file that's listed in the "files" section of | 53 // Represents a single prefetched file that's listed in the "files" section of |
| 74 // a NaCl manifest file. | 54 // a NaCl manifest file. |
| 75 struct NaClResourcePrefetchResult { | 55 struct NaClResourcePrefetchResult { |
| 76 NaClResourcePrefetchResult(); | 56 NaClResourcePrefetchResult(); |
| 77 NaClResourcePrefetchResult(IPC::PlatformFileForTransit file, | 57 NaClResourcePrefetchResult(const IPC::PlatformFileForTransit& file, |
| 78 const base::FilePath& file_path, | 58 const base::FilePath& file_path, |
| 79 const std::string& file_key); | 59 const std::string& file_key); |
| 80 ~NaClResourcePrefetchResult(); | 60 ~NaClResourcePrefetchResult(); |
| 81 | 61 |
| 82 IPC::PlatformFileForTransit file; | 62 IPC::PlatformFileForTransit file; |
| 83 base::FilePath file_path_metadata; // a key for validation caching | 63 base::FilePath file_path_metadata; // a key for validation caching |
| 84 std::string file_key; // a key for open_resource | 64 std::string file_key; // a key for open_resource |
| 85 }; | 65 }; |
| 86 | 66 |
| 87 // Parameters sent to the NaCl process when we start it. | 67 // Parameters sent to the NaCl process when we start it. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 int render_view_id; | 134 int render_view_id; |
| 155 uint32 permission_bits; | 135 uint32 permission_bits; |
| 156 bool uses_nonsfi_mode; | 136 bool uses_nonsfi_mode; |
| 157 | 137 |
| 158 NaClAppProcessType process_type; | 138 NaClAppProcessType process_type; |
| 159 }; | 139 }; |
| 160 | 140 |
| 161 struct NaClLaunchResult { | 141 struct NaClLaunchResult { |
| 162 NaClLaunchResult(); | 142 NaClLaunchResult(); |
| 163 NaClLaunchResult( | 143 NaClLaunchResult( |
| 164 FileDescriptor imc_channel_handle, | 144 const IPC::PlatformFileForTransit& imc_channel_handle, |
| 165 const IPC::ChannelHandle& ppapi_ipc_channel_handle, | 145 const IPC::ChannelHandle& ppapi_ipc_channel_handle, |
| 166 const IPC::ChannelHandle& trusted_ipc_channel_handle, | 146 const IPC::ChannelHandle& trusted_ipc_channel_handle, |
| 167 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, | 147 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, |
| 168 base::ProcessId plugin_pid, | 148 base::ProcessId plugin_pid, |
| 169 int plugin_child_id, | 149 int plugin_child_id, |
| 170 base::SharedMemoryHandle crash_info_shmem_handle); | 150 base::SharedMemoryHandle crash_info_shmem_handle); |
| 171 ~NaClLaunchResult(); | 151 ~NaClLaunchResult(); |
| 172 | 152 |
| 173 // For plugin loader <-> renderer IMC communication. | 153 // For plugin loader <-> renderer IMC communication. |
| 174 FileDescriptor imc_channel_handle; | 154 IPC::PlatformFileForTransit imc_channel_handle; |
| 175 | 155 |
| 176 // For plugin <-> renderer PPAPI communication. | 156 // For plugin <-> renderer PPAPI communication. |
| 177 IPC::ChannelHandle ppapi_ipc_channel_handle; | 157 IPC::ChannelHandle ppapi_ipc_channel_handle; |
| 178 | 158 |
| 179 // For plugin loader <-> renderer control communication (loading and | 159 // For plugin loader <-> renderer control communication (loading and |
| 180 // starting nexe). | 160 // starting nexe). |
| 181 IPC::ChannelHandle trusted_ipc_channel_handle; | 161 IPC::ChannelHandle trusted_ipc_channel_handle; |
| 182 | 162 |
| 183 // For plugin <-> renderer ManifestService communication. | 163 // For plugin <-> renderer ManifestService communication. |
| 184 IPC::ChannelHandle manifest_service_ipc_channel_handle; | 164 IPC::ChannelHandle manifest_service_ipc_channel_handle; |
| 185 | 165 |
| 186 base::ProcessId plugin_pid; | 166 base::ProcessId plugin_pid; |
| 187 int plugin_child_id; | 167 int plugin_child_id; |
| 188 | 168 |
| 189 // For NaCl <-> renderer crash information reporting. | 169 // For NaCl <-> renderer crash information reporting. |
| 190 base::SharedMemoryHandle crash_info_shmem_handle; | 170 base::SharedMemoryHandle crash_info_shmem_handle; |
| 191 }; | 171 }; |
| 192 | 172 |
| 193 } // namespace nacl | 173 } // namespace nacl |
| 194 | 174 |
| 195 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 175 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
| OLD | NEW |