Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / chrome / common / nacl_types.h
blobca44e03915a1a650cdecbcb88a3a2e796d2dfe7d
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.
5 #ifndef CHROME_COMMON_NACL_TYPES_H_
6 #define CHROME_COMMON_NACL_TYPES_H_
8 #include <string>
9 #include <vector>
11 #include "build/build_config.h"
13 #if defined(OS_POSIX)
14 #include "base/file_descriptor_posix.h"
15 #endif
17 #if defined(OS_WIN)
18 #include <windows.h> // for HANDLE
19 #endif
21 // TODO(gregoryd): add a Windows definition for base::FileDescriptor
22 namespace nacl {
24 #if defined(OS_WIN)
25 // We assume that HANDLE always uses less than 32 bits
26 typedef int FileDescriptor;
27 inline HANDLE ToNativeHandle(const FileDescriptor& desc) {
28 return reinterpret_cast<HANDLE>(desc);
30 #elif defined(OS_POSIX)
31 typedef base::FileDescriptor FileDescriptor;
32 inline int ToNativeHandle(const FileDescriptor& desc) {
33 return desc.fd;
35 #endif
38 // Parameters sent to the NaCl process when we start it.
40 // If you change this, you will also need to update the IPC serialization in
41 // nacl_messages.h.
42 struct NaClStartParams {
43 NaClStartParams();
44 ~NaClStartParams();
46 std::vector<FileDescriptor> handles;
47 FileDescriptor debug_stub_server_bound_socket;
49 bool validation_cache_enabled;
50 std::string validation_cache_key;
51 // Chrome version string. Sending the version string over IPC avoids linkage
52 // issues in cases where NaCl is not compiled into the main Chromium
53 // executable or DLL.
54 std::string version;
56 bool enable_exception_handling;
57 bool enable_debug_stub;
58 bool enable_ipc_proxy;
61 } // namespace nacl
63 #endif // CHROME_COMMON_NACL_TYPES_H_