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_handle.h" |
| 17 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
| 18 | 18 |
|
Mark Seaborn
2015/04/17 22:13:45
Nit: remove 1 empty line so that there's only 1 be
hidehiko
2015/04/30 16:33:02
Done.
| |
| 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 | 19 |
| 27 // TODO(gregoryd): add a Windows definition for base::FileDescriptor | 20 // TODO(gregoryd): add a Windows definition for base::FileDescriptor |
| 28 namespace nacl { | 21 namespace nacl { |
| 29 | 22 |
| 30 #if defined(OS_WIN) | |
| 31 typedef HANDLE FileDescriptor; | |
| 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 | 23 // We allocate a page of shared memory for sharing crash information from |
| 43 // trusted code in the NaCl process to the renderer. | 24 // trusted code in the NaCl process to the renderer. |
| 44 static const int kNaClCrashInfoShmemSize = 4096; | 25 static const int kNaClCrashInfoShmemSize = 4096; |
| 45 static const int kNaClCrashInfoMaxLogSize = 1024; | 26 static const int kNaClCrashInfoMaxLogSize = 1024; |
| 46 | 27 |
| 47 // Types of untrusted NaCl processes. | 28 // Types of untrusted NaCl processes. |
| 48 enum NaClAppProcessType { | 29 enum NaClAppProcessType { |
| 49 kUnknownNaClProcessType, | 30 kUnknownNaClProcessType, |
| 50 // Runs user-provided *native* code. Enabled for Chrome Web Store apps. | 31 // Runs user-provided *native* code. Enabled for Chrome Web Store apps. |
| 51 kNativeNaClProcessType, | 32 kNativeNaClProcessType, |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 75 // Parameters sent to the NaCl process when we start it. | 56 // Parameters sent to the NaCl process when we start it. |
| 76 struct NaClStartParams { | 57 struct NaClStartParams { |
| 77 NaClStartParams(); | 58 NaClStartParams(); |
| 78 ~NaClStartParams(); | 59 ~NaClStartParams(); |
| 79 | 60 |
| 80 IPC::PlatformFileForTransit nexe_file; | 61 IPC::PlatformFileForTransit nexe_file; |
| 81 // Used only as a key for validation caching. | 62 // Used only as a key for validation caching. |
| 82 base::FilePath nexe_file_path_metadata; | 63 base::FilePath nexe_file_path_metadata; |
| 83 | 64 |
| 84 std::vector<NaClResourceFileInfo> prefetched_resource_files; | 65 std::vector<NaClResourceFileInfo> prefetched_resource_files; |
| 85 std::vector<FileDescriptor> handles; | 66 std::vector<IPC::PlatformFileForTransit> handles; |
| 86 FileDescriptor debug_stub_server_bound_socket; | 67 IPC::PlatformFileForTransit debug_stub_server_bound_socket; |
| 87 | 68 |
| 88 bool validation_cache_enabled; | 69 bool validation_cache_enabled; |
| 89 std::string validation_cache_key; | 70 std::string validation_cache_key; |
| 90 // Chrome version string. Sending the version string over IPC avoids linkage | 71 // Chrome version string. Sending the version string over IPC avoids linkage |
| 91 // issues in cases where NaCl is not compiled into the main Chromium | 72 // issues in cases where NaCl is not compiled into the main Chromium |
| 92 // executable or DLL. | 73 // executable or DLL. |
| 93 std::string version; | 74 std::string version; |
| 94 | 75 |
| 95 bool enable_debug_stub; | 76 bool enable_debug_stub; |
| 96 bool enable_ipc_proxy; | 77 bool enable_ipc_proxy; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 int render_view_id; | 121 int render_view_id; |
| 141 uint32 permission_bits; | 122 uint32 permission_bits; |
| 142 bool uses_nonsfi_mode; | 123 bool uses_nonsfi_mode; |
| 143 | 124 |
| 144 NaClAppProcessType process_type; | 125 NaClAppProcessType process_type; |
| 145 }; | 126 }; |
| 146 | 127 |
| 147 struct NaClLaunchResult { | 128 struct NaClLaunchResult { |
| 148 NaClLaunchResult(); | 129 NaClLaunchResult(); |
| 149 NaClLaunchResult( | 130 NaClLaunchResult( |
| 150 FileDescriptor imc_channel_handle, | 131 const IPC::PlatformFileForTransit& imc_channel_handle, |
| 151 const IPC::ChannelHandle& ppapi_ipc_channel_handle, | 132 const IPC::ChannelHandle& ppapi_ipc_channel_handle, |
| 152 const IPC::ChannelHandle& trusted_ipc_channel_handle, | 133 const IPC::ChannelHandle& trusted_ipc_channel_handle, |
| 153 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, | 134 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, |
| 154 base::ProcessId plugin_pid, | 135 base::ProcessId plugin_pid, |
| 155 int plugin_child_id, | 136 int plugin_child_id, |
| 156 base::SharedMemoryHandle crash_info_shmem_handle); | 137 base::SharedMemoryHandle crash_info_shmem_handle); |
| 157 ~NaClLaunchResult(); | 138 ~NaClLaunchResult(); |
| 158 | 139 |
| 159 // For plugin loader <-> renderer IMC communication. | 140 // For plugin loader <-> renderer IMC communication. |
| 160 FileDescriptor imc_channel_handle; | 141 IPC::PlatformFileForTransit imc_channel_handle; |
| 161 | 142 |
| 162 // For plugin <-> renderer PPAPI communication. | 143 // For plugin <-> renderer PPAPI communication. |
| 163 IPC::ChannelHandle ppapi_ipc_channel_handle; | 144 IPC::ChannelHandle ppapi_ipc_channel_handle; |
| 164 | 145 |
| 165 // For plugin loader <-> renderer control communication (loading and | 146 // For plugin loader <-> renderer control communication (loading and |
| 166 // starting nexe). | 147 // starting nexe). |
| 167 IPC::ChannelHandle trusted_ipc_channel_handle; | 148 IPC::ChannelHandle trusted_ipc_channel_handle; |
| 168 | 149 |
| 169 // For plugin <-> renderer ManifestService communication. | 150 // For plugin <-> renderer ManifestService communication. |
| 170 IPC::ChannelHandle manifest_service_ipc_channel_handle; | 151 IPC::ChannelHandle manifest_service_ipc_channel_handle; |
| 171 | 152 |
| 172 base::ProcessId plugin_pid; | 153 base::ProcessId plugin_pid; |
| 173 int plugin_child_id; | 154 int plugin_child_id; |
| 174 | 155 |
| 175 // For NaCl <-> renderer crash information reporting. | 156 // For NaCl <-> renderer crash information reporting. |
| 176 base::SharedMemoryHandle crash_info_shmem_handle; | 157 base::SharedMemoryHandle crash_info_shmem_handle; |
| 177 }; | 158 }; |
| 178 | 159 |
| 179 } // namespace nacl | 160 } // namespace nacl |
| 180 | 161 |
| 181 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 162 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
| OLD | NEW |