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

Side by Side Diff: mojo/edk/embedder/platform_handle.cc

Issue 1712143002: [mojo-edk] Add support for transferring mach ports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More stuff. Created 4 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/edk/embedder/platform_handle.h" 5 #include "mojo/edk/embedder/platform_handle.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #if defined(OS_POSIX) 8 #if defined(OS_POSIX)
9 #include <unistd.h> 9 #include <unistd.h>
10 #elif defined(OS_WIN) 10 #elif defined(OS_WIN)
(...skipping 12 matching lines...) Expand all
23 return; 23 return;
24 24
25 #if defined(OS_POSIX) 25 #if defined(OS_POSIX)
26 if (type == Type::POSIX) { 26 if (type == Type::POSIX) {
27 bool success = (close(handle) == 0); 27 bool success = (close(handle) == 0);
28 DPCHECK(success); 28 DPCHECK(success);
29 handle = -1; 29 handle = -1;
30 } 30 }
31 #if defined(OS_MACOSX) && !defined(OS_IOS) 31 #if defined(OS_MACOSX) && !defined(OS_IOS)
32 else { 32 else {
33 kern_return_t rv = mach_port_deallocate(mach_task_self(), port); 33 kern_return_t rv = mach_port_deallocate(mach_task_self(), port);
34 DPCHECK(rv == KERN_SUCCESS); 34 DPCHECK(rv == KERN_SUCCESS);
35 port = MACH_PORT_NULL; 35 port = MACH_PORT_NULL;
36 } 36 }
37 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 37 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
38 #elif defined(OS_WIN) 38 #elif defined(OS_WIN)
39 bool success = !!CloseHandle(handle); 39 bool success = !!CloseHandle(handle);
40 DPCHECK(success); 40 DPCHECK(success);
41 handle = INVALID_HANDLE_VALUE; 41 handle = INVALID_HANDLE_VALUE;
42 #else 42 #else
43 #error "Platform not yet supported." 43 #error "Platform not yet supported."
44 #endif 44 #endif
45 } 45 }
46 46
47 } // namespace edk 47 } // namespace edk
48 } // namespace mojo 48 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698