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

Side by Side Diff: base/mac/mach_port_util.h

Issue 1778203002: Move mach code shared by Chrome IPC and Mojo to //base/mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum for error code 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
« no previous file with comments | « base/base.gypi ('k') | base/mac/mach_port_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_MAC_MACH_PORT_UTIL_H_
6 #define BASE_MAC_MACH_PORT_UTIL_H_
7
8 #include <mach/mach.h>
9
10 #include "base/base_export.h"
11 #include "base/mac/scoped_mach_port.h"
12
13 namespace base {
14
15 enum class MachCreateError {
16 ERROR_MAKE_RECEIVE_PORT,
17 ERROR_SET_ATTRIBUTES,
18 ERROR_EXTRACT_DEST_RIGHT,
19 ERROR_SEND_MACH_PORT,
20 };
21
22 // Sends a Mach port to |dest_port|. Assumes that |dest_port| is a send once
23 // right. Takes ownership of |dest_port|.
24 BASE_EXPORT kern_return_t SendMachPort(mach_port_t dest_port,
25 mach_port_t port_to_send,
26 int disposition);
27
28 // Receives a Mach port from |port_to_listen_on|, which should have exactly one
29 // queued message. Returns |MACH_PORT_NULL| on any error.
30 BASE_EXPORT base::mac::ScopedMachSendRight ReceiveMachPort(
31 mach_port_t port_to_listen_on);
32
33 // Creates an intermediate Mach port in |task_port| and sends |port_to_insert|
34 // as a mach_msg to the intermediate Mach port.
35 // |task_port| is the task port of another process.
36 // |port_to_insert| must be a send right in the current task's name space.
37 // Returns the intermediate port on success, and MACH_PORT_NULL on failure.
38 // On failure, |error_code| is set if not null.
39 // This method takes ownership of |port_to_insert|. On success, ownership is
40 // passed to the intermediate Mach port.
41 BASE_EXPORT mach_port_name_t CreateIntermediateMachPort(
42 mach_port_t task_port,
43 base::mac::ScopedMachSendRight port_to_insert,
44 MachCreateError* error_code);
45
46 } // namespace base
47
48 #endif // BASE_MAC_MACH_PORT_UTIL_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/mac/mach_port_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698