cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ipc / ipc_platform_file.h
blob553c78c522f2ca4b602d60ec7ba8edf5bad405df
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
3 // found in the LICENSE file.
5 #ifndef IPC_IPC_PLATFORM_FILE_H_
6 #define IPC_IPC_PLATFORM_FILE_H_
8 #include "base/basictypes.h"
9 #include "base/platform_file.h"
10 #include "base/process/process.h"
11 #include "ipc/ipc_export.h"
13 #if defined(OS_POSIX)
14 #include "base/file_descriptor_posix.h"
15 #endif
17 namespace IPC {
19 #if defined(OS_WIN)
20 typedef base::PlatformFile PlatformFileForTransit;
21 #elif defined(OS_POSIX)
22 typedef base::FileDescriptor PlatformFileForTransit;
23 #endif
25 inline PlatformFileForTransit InvalidPlatformFileForTransit() {
26 #if defined(OS_WIN)
27 return base::kInvalidPlatformFileValue;
28 #elif defined(OS_POSIX)
29 return base::FileDescriptor();
30 #endif
33 inline base::PlatformFile PlatformFileForTransitToPlatformFile(
34 const PlatformFileForTransit& transit) {
35 #if defined(OS_WIN)
36 return transit;
37 #elif defined(OS_POSIX)
38 return transit.fd;
39 #endif
42 // Returns a file handle equivalent to |file| that can be used in |process|.
43 IPC_EXPORT PlatformFileForTransit GetFileHandleForProcess(
44 base::PlatformFile file,
45 base::ProcessHandle process,
46 bool close_source_handle);
48 } // namespace IPC
50 #endif // IPC_IPC_PLATFORM_FILE_H_