#ifndef IPC_IPC_PLATFORM_FILE_H_
#define IPC_IPC_PLATFORM_FILE_H_
#include "base/files/file.h"
#include "base/process/process.h"
#include "build/build_config.h"
#include "ipc/ipc_message_support_export.h"
#if BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
#include "base/file_descriptor_posix.h"
#endif
namespace IPC {
#if BUILDFLAG(IS_WIN)
class IPC_MESSAGE_SUPPORT_EXPORT PlatformFileForTransit {
public:
PlatformFileForTransit();
explicit PlatformFileForTransit(HANDLE handle);
bool operator==(const PlatformFileForTransit& platform_file) const;
bool operator!=(const PlatformFileForTransit& platform_file) const;
HANDLE GetHandle() const;
bool IsValid() const;
private:
HANDLE handle_;
};
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
PlatformFileForTransit;
#endif
inline PlatformFileForTransit InvalidPlatformFileForTransit() { … }
inline base::PlatformFile PlatformFileForTransitToPlatformFile(
const PlatformFileForTransit& transit) { … }
inline base::File PlatformFileForTransitToFile(
const PlatformFileForTransit& transit) { … }
IPC_MESSAGE_SUPPORT_EXPORT PlatformFileForTransit
GetPlatformFileForTransit(base::PlatformFile file, bool close_source_handle);
IPC_MESSAGE_SUPPORT_EXPORT PlatformFileForTransit
TakePlatformFileForTransit(base::File file);
}
#endif