| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Handle passing definitions for NaCl | |
| 6 #ifndef CHROME_COMMON_NACL_TYPES_H_ | 5 #ifndef CHROME_COMMON_NACL_TYPES_H_ |
| 7 #define CHROME_COMMON_NACL_TYPES_H_ | 6 #define CHROME_COMMON_NACL_TYPES_H_ |
| 8 #pragma once | 7 #pragma once |
| 9 | 8 |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 |
| 11 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
| 12 #include "base/file_descriptor_posix.h" | 15 #include "base/file_descriptor_posix.h" |
| 13 #endif | 16 #endif |
| 14 | 17 |
| 15 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 16 #include <windows.h> // for HANDLE | 19 #include <windows.h> // for HANDLE |
| 17 #endif | 20 #endif |
| 18 | 21 |
| 19 // TODO(gregoryd): add a Windows definition for base::FileDescriptor | 22 // TODO(gregoryd): add a Windows definition for base::FileDescriptor |
| 20 namespace nacl { | 23 namespace nacl { |
| 24 |
| 21 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 22 // We assume that HANDLE always uses less than 32 bits | 26 // We assume that HANDLE always uses less than 32 bits |
| 23 typedef int FileDescriptor; | 27 typedef int FileDescriptor; |
| 24 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { | 28 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { |
| 25 return reinterpret_cast<HANDLE>(desc); | 29 return reinterpret_cast<HANDLE>(desc); |
| 26 } | 30 } |
| 27 #elif defined(OS_POSIX) | 31 #elif defined(OS_POSIX) |
| 28 typedef base::FileDescriptor FileDescriptor; | 32 typedef base::FileDescriptor FileDescriptor; |
| 29 inline int ToNativeHandle(const FileDescriptor& desc) { | 33 inline int ToNativeHandle(const FileDescriptor& desc) { |
| 30 return desc.fd; | 34 return desc.fd; |
| 31 } | 35 } |
| 32 #endif | 36 #endif |
| 33 } | 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 std::string validation_cache_key; |
| 49 |
| 50 // Chrome version string. Sending the version string over IPC avoids linkage |
| 51 // issues in cases where NaCl is not compiled into the main Chromium |
| 52 // executable or DLL. |
| 53 std::string version; |
| 54 |
| 55 bool enable_exception_handling; |
| 56 }; |
| 57 |
| 58 } // namespace nacl |
| 34 | 59 |
| 35 #endif // CHROME_COMMON_NACL_TYPES_H_ | 60 #endif // CHROME_COMMON_NACL_TYPES_H_ |
| OLD | NEW |