OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_COMMON_NACL_TYPES_H_ | |
6 #define CHROME_COMMON_NACL_TYPES_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "build/build_config.h" | |
13 | |
14 #if defined(OS_POSIX) | |
15 #include "base/file_descriptor_posix.h" | |
16 #endif | |
17 | |
18 #if defined(OS_WIN) | |
19 #include <windows.h> // for HANDLE | |
20 #endif | |
21 | |
22 // TODO(gregoryd): add a Windows definition for base::FileDescriptor | |
23 namespace nacl { | |
24 | |
25 #if defined(OS_WIN) | |
26 // We assume that HANDLE always uses less than 32 bits | |
27 typedef int FileDescriptor; | |
28 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { | |
29 return reinterpret_cast<HANDLE>(desc); | |
30 } | |
31 #elif defined(OS_POSIX) | |
32 typedef base::FileDescriptor FileDescriptor; | |
33 inline int ToNativeHandle(const FileDescriptor& desc) { | |
34 return desc.fd; | |
35 } | |
36 #endif | |
37 | |
38 | |
39 // Parameters sent to the NaCl process when we start it. | |
40 // | |
41 // If you change this, you will also need to update the IPC serialization in | |
42 // nacl_messages.h. | |
43 struct NaClStartParams { | |
44 NaClStartParams(); | |
45 ~NaClStartParams(); | |
46 | |
47 std::vector<FileDescriptor> handles; | |
48 FileDescriptor debug_stub_server_bound_socket; | |
49 | |
50 bool validation_cache_enabled; | |
51 std::string validation_cache_key; | |
52 // Chrome version string. Sending the version string over IPC avoids linkage | |
53 // issues in cases where NaCl is not compiled into the main Chromium | |
54 // executable or DLL. | |
55 std::string version; | |
56 | |
57 bool enable_exception_handling; | |
58 bool enable_debug_stub; | |
59 bool enable_ipc_proxy; | |
60 bool uses_irt; | |
61 bool enable_dyncode_syscalls; | |
62 }; | |
63 | |
64 // Parameters sent to the browser process to have it launch a NaCl process. | |
65 // | |
66 // If you change this, you will also need to update the IPC serialization in | |
67 // renderer_messages.h. | |
68 struct NaClLaunchParams { | |
69 NaClLaunchParams(); | |
70 NaClLaunchParams(const std::string& u, int r, uint32 p, bool uses_irt, | |
71 bool enable_dyncode_syscalls, | |
72 bool enable_exception_handling); | |
73 NaClLaunchParams(const NaClLaunchParams& l); | |
74 ~NaClLaunchParams(); | |
75 | |
76 std::string manifest_url; | |
77 int render_view_id; | |
78 uint32 permission_bits; | |
79 bool uses_irt; | |
80 bool enable_dyncode_syscalls; | |
81 bool enable_exception_handling; | |
82 }; | |
83 | |
84 } // namespace nacl | |
85 | |
86 #endif // CHROME_COMMON_NACL_TYPES_H_ | |
OLD | NEW |