Chromium Code Reviews| 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 |
| 10 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 11 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| 12 #include "base/file_descriptor_posix.h" | 11 #include "base/file_descriptor_posix.h" |
| 13 #endif | 12 #endif |
| 14 | 13 |
| 15 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
| 16 #include <windows.h> // for HANDLE | 15 #include <windows.h> // for HANDLE |
| 17 #endif | 16 #endif |
| 18 | 17 |
| 19 // TODO(gregoryd): add a Windows definition for base::FileDescriptor | 18 // TODO(gregoryd): add a Windows definition for base::FileDescriptor |
| 20 namespace nacl { | 19 namespace nacl { |
| 20 | |
| 21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 22 // We assume that HANDLE always uses less than 32 bits | 22 // We assume that HANDLE always uses less than 32 bits |
| 23 typedef int FileDescriptor; | 23 typedef int FileDescriptor; |
| 24 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { | 24 inline HANDLE ToNativeHandle(const FileDescriptor& desc) { |
| 25 return reinterpret_cast<HANDLE>(desc); | 25 return reinterpret_cast<HANDLE>(desc); |
| 26 } | 26 } |
| 27 #elif defined(OS_POSIX) | 27 #elif defined(OS_POSIX) |
| 28 typedef base::FileDescriptor FileDescriptor; | 28 typedef base::FileDescriptor FileDescriptor; |
| 29 inline int ToNativeHandle(const FileDescriptor& desc) { | 29 inline int ToNativeHandle(const FileDescriptor& desc) { |
| 30 return desc.fd; | 30 return desc.fd; |
| 31 } | 31 } |
| 32 #endif | 32 #endif |
| 33 } | 33 |
| 34 | |
| 35 // Parameters sent to the nacl process when we start it. | |
|
Mark Seaborn
2012/04/06 23:13:50
'nacl' -> 'NaCl'
| |
| 36 // | |
| 37 // If you change this, you will also need to update the IPC serialization in | |
| 38 // nacl_messages.h. | |
| 39 struct NaClStartParams { | |
| 40 std::vector<FileDescriptor> sockets; | |
|
Mark Seaborn
2012/04/06 23:13:50
"sockets" -> "handles" (see other comment)
| |
| 41 std::string validation_cache_key; | |
| 42 std::string version; | |
| 43 bool enable_exception_handling; | |
| 44 }; | |
| 45 | |
| 46 } // namespace nacl | |
| 34 | 47 |
| 35 #endif // CHROME_COMMON_NACL_TYPES_H_ | 48 #endif // CHROME_COMMON_NACL_TYPES_H_ |
| OLD | NEW |