Chromium Code Reviews| Index: mojo/public/cpp/system/platform_handle.cc |
| diff --git a/mojo/public/cpp/system/platform_handle.cc b/mojo/public/cpp/system/platform_handle.cc |
| index 42e4abac832c703db4f52a0e0fc4e13ba3256684..63c8c1406ec54d26ffe2d04d20b386df0a4edf6b 100644 |
| --- a/mojo/public/cpp/system/platform_handle.cc |
| +++ b/mojo/public/cpp/system/platform_handle.cc |
| @@ -66,22 +66,15 @@ ScopedSharedBufferHandle WrapSharedMemoryHandle( |
| const base::SharedMemoryHandle& memory_handle, |
| size_t size, |
| bool read_only) { |
| -#if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| - if (memory_handle.fd == base::kInvalidPlatformFile) |
| - return ScopedSharedBufferHandle(); |
| -#else |
| if (!memory_handle.IsValid()) |
| return ScopedSharedBufferHandle(); |
| -#endif |
| MojoPlatformHandle platform_handle; |
| platform_handle.struct_size = sizeof(MojoPlatformHandle); |
| platform_handle.type = kPlatformSharedBufferHandleType; |
| #if defined(OS_MACOSX) && !defined(OS_IOS) |
| platform_handle.value = |
| static_cast<uint64_t>(memory_handle.GetMemoryObject()); |
| -#elif defined(OS_POSIX) |
| - platform_handle.value = PlatformHandleValueFromPlatformFile(memory_handle.fd); |
| -#elif defined(OS_WIN) |
| +#else |
| platform_handle.value = |
| PlatformHandleValueFromPlatformFile(memory_handle.GetHandle()); |
| #endif |
| @@ -129,7 +122,7 @@ MojoResult UnwrapSharedMemoryHandle(ScopedSharedBufferHandle handle, |
| #elif defined(OS_POSIX) |
| CHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_FILE_DESCRIPTOR); |
| *memory_handle = base::SharedMemoryHandle( |
| - static_cast<int>(platform_handle.value), false); |
| + base::FileDescriptor(static_cast<int>(platform_handle.value), false)); |
|
Nico
2017/04/27 16:24:44
random complaint about bare bool values looking me
erikchen
2017/04/27 17:08:11
Sorry? This is just a refactor...
|
| #elif defined(OS_WIN) |
| CHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE); |
| *memory_handle = base::SharedMemoryHandle( |