Chromium Code Reviews| Index: ipc/ipc_platform_file.cc |
| diff --git a/ipc/ipc_platform_file.cc b/ipc/ipc_platform_file.cc |
| index dbcfddcc779e69ff8fab92b1523c1551ada522e9..963945591a4bc07038ca1de8e5fa4b883f6da118 100644 |
| --- a/ipc/ipc_platform_file.cc |
| +++ b/ipc/ipc_platform_file.cc |
| @@ -11,6 +11,32 @@ |
| namespace IPC { |
| +#if defined(OS_WIN) |
| +PlatformFileForTransit::PlatformFileForTransit() : handle_(nullptr){}; |
|
Mark Seaborn
2017/04/28 22:45:21
Nit: remove ';' and add space before '{}'
erikchen
2017/04/28 23:24:37
Interesting. Removing the ";" causes clang-format
|
| + |
| +PlatformFileForTransit::PlatformFileForTransit(HANDLE handle) |
| + : handle_(handle){}; |
|
Mark Seaborn
2017/04/28 22:45:21
Ditto
erikchen
2017/04/28 23:24:37
Interesting. Removing the ";" causes clang-format
|
| + |
| +bool PlatformFileForTransit::operator==( |
| + const PlatformFileForTransit& platform_file) const { |
| + return handle_ == platform_file.handle_; |
| +} |
| + |
| +bool PlatformFileForTransit::operator!=( |
| + const PlatformFileForTransit& platform_file) const { |
| + return !(*this == platform_file); |
| +} |
| + |
| +HANDLE PlatformFileForTransit::GetHandle() const { |
| + return handle_; |
| +} |
| + |
| +bool PlatformFileForTransit::IsValid() const { |
| + return handle_ != nullptr; |
| +} |
| + |
| +#endif // defined(OS_WIN) |
| + |
| PlatformFileForTransit GetPlatformFileForTransit(base::PlatformFile handle, |
| bool close_source_handle) { |
| #if defined(OS_WIN) |
| @@ -24,10 +50,7 @@ PlatformFileForTransit GetPlatformFileForTransit(base::PlatformFile handle, |
| return IPC::InvalidPlatformFileForTransit(); |
| } |
| - IPC::PlatformFileForTransit out_handle = IPC::PlatformFileForTransit( |
| - raw_handle, base::GetCurrentProcId()); |
| - out_handle.SetOwnershipPassesToIPC(true); |
| - return out_handle; |
| + return IPC::PlatformFileForTransit(raw_handle); |
| #elif defined(OS_POSIX) |
| // If asked to close the source, we can simply re-use the source fd instead of |
| // dup()ing and close()ing. |