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 <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/shared_memory.h" |
12 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
14 #include "ipc/ipc_channel.h" | 15 #include "ipc/ipc_channel.h" |
15 #include "ipc/ipc_platform_file.h" | 16 #include "ipc/ipc_platform_file.h" |
16 | 17 |
17 #if defined(OS_POSIX) | 18 #if defined(OS_POSIX) |
18 #include "base/file_descriptor_posix.h" | 19 #include "base/file_descriptor_posix.h" |
19 #endif | 20 #endif |
20 | 21 |
21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
22 #include <windows.h> // for HANDLE | 23 #include <windows.h> // for HANDLE |
23 #endif | 24 #endif |
24 | 25 |
25 // TODO(gregoryd): add a Windows definition for base::FileDescriptor | 26 // TODO(gregoryd): add a Windows definition for base::FileDescriptor |
26 namespace nacl { | 27 namespace nacl { |
27 | 28 |
28 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
29 typedef HANDLE FileDescriptor; | 30 typedef HANDLE FileDescriptor; |
30 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { | 31 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { |
31 return desc; | 32 return desc; |
32 } | 33 } |
33 #elif defined(OS_POSIX) | 34 #elif defined(OS_POSIX) |
34 typedef base::FileDescriptor FileDescriptor; | 35 typedef base::FileDescriptor FileDescriptor; |
35 inline int ToNativeHandle(const FileDescriptor& desc) { | 36 inline int ToNativeHandle(const FileDescriptor& desc) { |
36 return desc.fd; | 37 return desc.fd; |
37 } | 38 } |
38 #endif | 39 #endif |
39 | 40 |
| 41 // We allocate a page of shared memory for sharing crash information from |
| 42 // trusted code in the NaCl process to the renderer. |
| 43 static const int kNaClCrashInfoShmemSize = 4096; |
| 44 static const int kNaClCrashInfoMaxLogSize = 1024; |
40 | 45 |
41 // Parameters sent to the NaCl process when we start it. | 46 // Parameters sent to the NaCl process when we start it. |
42 struct NaClStartParams { | 47 struct NaClStartParams { |
43 NaClStartParams(); | 48 NaClStartParams(); |
44 ~NaClStartParams(); | 49 ~NaClStartParams(); |
45 | 50 |
46 IPC::PlatformFileForTransit nexe_file; | 51 IPC::PlatformFileForTransit nexe_file; |
47 uint64_t nexe_token_lo; | 52 uint64_t nexe_token_lo; |
48 uint64_t nexe_token_hi; | 53 uint64_t nexe_token_hi; |
49 | 54 |
50 std::vector<FileDescriptor> handles; | 55 std::vector<FileDescriptor> handles; |
51 FileDescriptor debug_stub_server_bound_socket; | 56 FileDescriptor debug_stub_server_bound_socket; |
52 | 57 |
53 bool validation_cache_enabled; | 58 bool validation_cache_enabled; |
54 std::string validation_cache_key; | 59 std::string validation_cache_key; |
55 // Chrome version string. Sending the version string over IPC avoids linkage | 60 // Chrome version string. Sending the version string over IPC avoids linkage |
56 // issues in cases where NaCl is not compiled into the main Chromium | 61 // issues in cases where NaCl is not compiled into the main Chromium |
57 // executable or DLL. | 62 // executable or DLL. |
58 std::string version; | 63 std::string version; |
59 | 64 |
60 bool enable_exception_handling; | 65 bool enable_exception_handling; |
61 bool enable_debug_stub; | 66 bool enable_debug_stub; |
62 bool enable_ipc_proxy; | 67 bool enable_ipc_proxy; |
63 bool uses_irt; | 68 bool uses_irt; |
64 bool enable_dyncode_syscalls; | 69 bool enable_dyncode_syscalls; |
65 | 70 |
| 71 // For NaCl <-> renderer crash information reporting. |
| 72 base::SharedMemoryHandle crash_info_shmem_handle; |
| 73 |
66 // NOTE: Any new fields added here must also be added to the IPC | 74 // NOTE: Any new fields added here must also be added to the IPC |
67 // serialization in nacl_messages.h and (for POD fields) the constructor | 75 // serialization in nacl_messages.h and (for POD fields) the constructor |
68 // in nacl_types.cc. | 76 // in nacl_types.cc. |
69 }; | 77 }; |
70 | 78 |
71 // Parameters sent to the browser process to have it launch a NaCl process. | 79 // Parameters sent to the browser process to have it launch a NaCl process. |
72 // | 80 // |
73 // If you change this, you will also need to update the IPC serialization in | 81 // If you change this, you will also need to update the IPC serialization in |
74 // nacl_host_messages.h. | 82 // nacl_host_messages.h. |
75 struct NaClLaunchParams { | 83 struct NaClLaunchParams { |
(...skipping 29 matching lines...) Expand all Loading... |
105 }; | 113 }; |
106 | 114 |
107 struct NaClLaunchResult { | 115 struct NaClLaunchResult { |
108 NaClLaunchResult(); | 116 NaClLaunchResult(); |
109 NaClLaunchResult( | 117 NaClLaunchResult( |
110 FileDescriptor imc_channel_handle, | 118 FileDescriptor imc_channel_handle, |
111 const IPC::ChannelHandle& ppapi_ipc_channel_handle, | 119 const IPC::ChannelHandle& ppapi_ipc_channel_handle, |
112 const IPC::ChannelHandle& trusted_ipc_channel_handle, | 120 const IPC::ChannelHandle& trusted_ipc_channel_handle, |
113 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, | 121 const IPC::ChannelHandle& manifest_service_ipc_channel_handle, |
114 base::ProcessId plugin_pid, | 122 base::ProcessId plugin_pid, |
115 int plugin_child_id); | 123 int plugin_child_id, |
| 124 base::SharedMemoryHandle crash_info_shmem_handle); |
116 ~NaClLaunchResult(); | 125 ~NaClLaunchResult(); |
117 | 126 |
118 // For plugin loader <-> renderer IMC communication. | 127 // For plugin loader <-> renderer IMC communication. |
119 FileDescriptor imc_channel_handle; | 128 FileDescriptor imc_channel_handle; |
120 | 129 |
121 // For plugin <-> renderer PPAPI communication. | 130 // For plugin <-> renderer PPAPI communication. |
122 IPC::ChannelHandle ppapi_ipc_channel_handle; | 131 IPC::ChannelHandle ppapi_ipc_channel_handle; |
123 | 132 |
124 // For plugin loader <-> renderer control communication (loading and | 133 // For plugin loader <-> renderer control communication (loading and |
125 // starting nexe). | 134 // starting nexe). |
126 IPC::ChannelHandle trusted_ipc_channel_handle; | 135 IPC::ChannelHandle trusted_ipc_channel_handle; |
127 | 136 |
128 // For plugin <-> renderer ManifestService communication. | 137 // For plugin <-> renderer ManifestService communication. |
129 IPC::ChannelHandle manifest_service_ipc_channel_handle; | 138 IPC::ChannelHandle manifest_service_ipc_channel_handle; |
130 | 139 |
131 base::ProcessId plugin_pid; | 140 base::ProcessId plugin_pid; |
132 int plugin_child_id; | 141 int plugin_child_id; |
| 142 |
| 143 // For NaCl <-> renderer crash information reporting. |
| 144 base::SharedMemoryHandle crash_info_shmem_handle; |
133 }; | 145 }; |
134 | 146 |
135 } // namespace nacl | 147 } // namespace nacl |
136 | 148 |
137 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ | 149 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_ |
OLD | NEW |