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/files/file.h" | 8 #include "base/files/file.h" |
9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 inline base::File PlatformFileForTransitToFile( | 49 inline base::File PlatformFileForTransitToFile( |
50 const PlatformFileForTransit& transit) { | 50 const PlatformFileForTransit& transit) { |
51 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
52 return base::File(transit.GetHandle()); | 52 return base::File(transit.GetHandle()); |
53 #elif defined(OS_POSIX) | 53 #elif defined(OS_POSIX) |
54 return base::File(transit.fd); | 54 return base::File(transit.fd); |
55 #endif | 55 #endif |
56 } | 56 } |
57 | 57 |
58 // Returns a file handle equivalent to |file| that can be used in |process|. | 58 // Creates a new handle that can be passed through IPC. The result must be |
59 IPC_EXPORT PlatformFileForTransit GetFileHandleForProcess( | 59 // passed to the IPC layer as part of a message, or else it will leak. |
| 60 IPC_EXPORT PlatformFileForTransit GetPlatformFileForTransit( |
60 base::PlatformFile file, | 61 base::PlatformFile file, |
61 base::ProcessHandle process, | |
62 bool close_source_handle); | 62 bool close_source_handle); |
63 | 63 |
64 // Returns a file handle equivalent to |file| that can be used in |process|. | 64 // Returns a file handle equivalent to |file| that can be used in |process|. |
65 // Note that this function takes ownership of |file|. | 65 // Note that this function takes ownership of |file|. |
66 IPC_EXPORT PlatformFileForTransit TakeFileHandleForProcess( | 66 IPC_EXPORT PlatformFileForTransit TakeFileHandleForProcess( |
67 base::File file, | 67 base::File file, |
68 base::ProcessHandle process); | 68 base::ProcessHandle process); |
69 | 69 |
70 } // namespace IPC | 70 } // namespace IPC |
71 | 71 |
72 #endif // IPC_IPC_PLATFORM_FILE_H_ | 72 #endif // IPC_IPC_PLATFORM_FILE_H_ |
OLD | NEW |