Chromium Code Reviews| Index: ipc/ipc_platform_file.h |
| diff --git a/ipc/ipc_platform_file.h b/ipc/ipc_platform_file.h |
| index 15807f60b75bd87cb05d7735a568f55d40eb3c84..96bcf6fde3370d11210e56811b870607b0de1826 100644 |
| --- a/ipc/ipc_platform_file.h |
| +++ b/ipc/ipc_platform_file.h |
| @@ -14,17 +14,35 @@ |
| #include "base/file_descriptor_posix.h" |
| #endif |
| -#if defined(OS_WIN) |
| -#include "base/memory/shared_memory_handle.h" |
| -#endif |
| - |
| namespace IPC { |
| #if defined(OS_WIN) |
| // The semantics for IPC transfer of a SharedMemoryHandle are exactly the same |
|
Mark Seaborn
2017/04/28 22:45:21
I think this reference to SharedMemoryHandle needs
erikchen
2017/04/28 23:24:37
This whole comment is no longer meaningful. Remove
|
| // as for a PlatformFileForTransit. The object wraps a HANDLE, and has some |
| // metadata that indicates the process to which the HANDLE belongs. |
|
Mark Seaborn
2017/04/28 22:45:21
PlatformFileForTransit no longer has this metadata
erikchen
2017/04/28 23:24:37
This whole comment is no longer meaningful. Remove
|
| -using PlatformFileForTransit = base::SharedMemoryHandle; |
| +class IPC_EXPORT PlatformFileForTransit { |
| + public: |
| + // Creates an invalid platform file. |
| + PlatformFileForTransit(); |
| + |
| + // Creates a platform file that takes unofficial ownership of |handle|. Note |
| + // that ownership is not handled by a Scoped* class due to usage patterns of |
| + // this class and its POSIX counterpart [base::FileDescriptor]. When this |
| + // class is used as an input to an IPC message, the IPC subsystem will close |
| + // |handle|. When this class is used as the output from an IPC message, the |
| + // receiver is expected to take ownership of |handle|. |
| + explicit PlatformFileForTransit(HANDLE handle); |
| + |
| + // Comparison operators. |
| + bool operator==(const PlatformFileForTransit& platform_file) const; |
| + bool operator!=(const PlatformFileForTransit& platform_file) const; |
| + |
| + HANDLE GetHandle() const; |
| + bool IsValid() const; |
| + |
| + private: |
| + HANDLE handle_; |
| +}; |
| #elif defined(OS_POSIX) |
| typedef base::FileDescriptor PlatformFileForTransit; |
| #endif |