Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Side by Side Diff: mojo/public/cpp/system/platform_handle.cc

Issue 2006703005: Define kInvalidPlatformFile in base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no ppapi Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/system/platform_handle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/public/cpp/system/platform_handle.h" 5 #include "mojo/public/cpp/system/platform_handle.h"
6 6
7 namespace mojo { 7 namespace mojo {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 MojoResult UnwrapPlatformFile(ScopedHandle handle, base::PlatformFile* file) { 42 MojoResult UnwrapPlatformFile(ScopedHandle handle, base::PlatformFile* file) {
43 MojoPlatformHandle platform_handle; 43 MojoPlatformHandle platform_handle;
44 platform_handle.struct_size = sizeof(MojoPlatformHandle); 44 platform_handle.struct_size = sizeof(MojoPlatformHandle);
45 MojoResult result = MojoUnwrapPlatformHandle(handle.release().value(), 45 MojoResult result = MojoUnwrapPlatformHandle(handle.release().value(),
46 &platform_handle); 46 &platform_handle);
47 if (result != MOJO_RESULT_OK) 47 if (result != MOJO_RESULT_OK)
48 return result; 48 return result;
49 49
50 if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_INVALID) { 50 if (platform_handle.type == MOJO_PLATFORM_HANDLE_TYPE_INVALID) {
51 *file = kInvalidPlatformFile; 51 *file = base::kInvalidPlatformFile;
52 } else { 52 } else {
53 CHECK_EQ(platform_handle.type, kPlatformFileHandleType); 53 CHECK_EQ(platform_handle.type, kPlatformFileHandleType);
54 *file = PlatformFileFromPlatformHandleValue(platform_handle.value); 54 *file = PlatformFileFromPlatformHandleValue(platform_handle.value);
55 } 55 }
56 56
57 return MOJO_RESULT_OK; 57 return MOJO_RESULT_OK;
58 } 58 }
59 59
60 ScopedSharedBufferHandle WrapSharedMemoryHandle( 60 ScopedSharedBufferHandle WrapSharedMemoryHandle(
61 const base::SharedMemoryHandle& memory_handle, 61 const base::SharedMemoryHandle& memory_handle,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 CHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE); 120 CHECK_EQ(platform_handle.type, MOJO_PLATFORM_HANDLE_TYPE_WINDOWS_HANDLE);
121 *memory_handle = base::SharedMemoryHandle( 121 *memory_handle = base::SharedMemoryHandle(
122 reinterpret_cast<HANDLE>(platform_handle.value), 122 reinterpret_cast<HANDLE>(platform_handle.value),
123 base::GetCurrentProcId()); 123 base::GetCurrentProcId());
124 #endif 124 #endif
125 125
126 return MOJO_RESULT_OK; 126 return MOJO_RESULT_OK;
127 } 127 }
128 128
129 } // namespace mojo 129 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/system/platform_handle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698