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 #ifndef IPC_IPC_PLATFORM_FILE_H_ | 5 #ifndef IPC_IPC_PLATFORM_FILE_H_ |
6 #define IPC_IPC_PLATFORM_FILE_H_ | 6 #define IPC_IPC_PLATFORM_FILE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/platform_file.h" | |
11 #include "base/process/process.h" | 10 #include "base/process/process.h" |
12 #include "ipc/ipc_export.h" | 11 #include "ipc/ipc_export.h" |
13 | 12 |
14 #if defined(OS_POSIX) | 13 #if defined(OS_POSIX) |
15 #include "base/file_descriptor_posix.h" | 14 #include "base/file_descriptor_posix.h" |
16 #endif | 15 #endif |
17 | 16 |
18 namespace IPC { | 17 namespace IPC { |
19 | 18 |
20 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
21 typedef base::PlatformFile PlatformFileForTransit; | 20 typedef base::PlatformFile PlatformFileForTransit; |
22 #elif defined(OS_POSIX) | 21 #elif defined(OS_POSIX) |
23 typedef base::FileDescriptor PlatformFileForTransit; | 22 typedef base::FileDescriptor PlatformFileForTransit; |
24 #endif | 23 #endif |
25 | 24 |
26 inline PlatformFileForTransit InvalidPlatformFileForTransit() { | 25 inline PlatformFileForTransit InvalidPlatformFileForTransit() { |
27 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
28 return base::kInvalidPlatformFileValue; | 27 return INVALID_HANDLE_VALUE; |
29 #elif defined(OS_POSIX) | 28 #elif defined(OS_POSIX) |
30 return base::FileDescriptor(); | 29 return base::FileDescriptor(); |
31 #endif | 30 #endif |
32 } | 31 } |
33 | 32 |
34 inline base::PlatformFile PlatformFileForTransitToPlatformFile( | 33 inline base::PlatformFile PlatformFileForTransitToPlatformFile( |
35 const PlatformFileForTransit& transit) { | 34 const PlatformFileForTransit& transit) { |
36 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
37 return transit; | 36 return transit; |
38 #elif defined(OS_POSIX) | 37 #elif defined(OS_POSIX) |
(...skipping 18 matching lines...) Expand all Loading... |
57 | 56 |
58 // Returns a file handle equivalent to |file| that can be used in |process|. | 57 // Returns a file handle equivalent to |file| that can be used in |process|. |
59 // Note that this function takes ownership of |file|. | 58 // Note that this function takes ownership of |file|. |
60 IPC_EXPORT PlatformFileForTransit TakeFileHandleForProcess( | 59 IPC_EXPORT PlatformFileForTransit TakeFileHandleForProcess( |
61 base::File file, | 60 base::File file, |
62 base::ProcessHandle process); | 61 base::ProcessHandle process); |
63 | 62 |
64 } // namespace IPC | 63 } // namespace IPC |
65 | 64 |
66 #endif // IPC_IPC_PLATFORM_FILE_H_ | 65 #endif // IPC_IPC_PLATFORM_FILE_H_ |
OLD | NEW |