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

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

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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/mac/dispatch_source_mach_unittest.cc ('k') | base/mac/scoped_authorizationref.h » ('j') | 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 #ifndef BASE_MAC_MACH_PORT_BROKER_H_ 5 #ifndef BASE_MAC_MACH_PORT_BROKER_H_
6 #define BASE_MAC_MACH_PORT_BROKER_H_ 6 #define BASE_MAC_MACH_PORT_BROKER_H_
7 7
8 #include <mach/mach.h> 8 #include <mach/mach.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory>
11 #include <string> 12 #include <string>
12 13
13 #include "base/base_export.h" 14 #include "base/base_export.h"
14 #include "base/mac/dispatch_source_mach.h" 15 #include "base/mac/dispatch_source_mach.h"
15 #include "base/mac/scoped_mach_port.h" 16 #include "base/mac/scoped_mach_port.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/scoped_ptr.h"
18 #include "base/process/port_provider_mac.h" 18 #include "base/process/port_provider_mac.h"
19 #include "base/process/process_handle.h" 19 #include "base/process/process_handle.h"
20 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
21 21
22 namespace base { 22 namespace base {
23 23
24 // On OS X, the task port of a process is required to collect metrics about the 24 // On OS X, the task port of a process is required to collect metrics about the
25 // process, and to insert Mach ports into the process. Running |task_for_pid()| 25 // process, and to insert Mach ports into the process. Running |task_for_pid()|
26 // is only allowed for privileged code. However, a process has port rights to 26 // is only allowed for privileged code. However, a process has port rights to
27 // all its subprocesses, so let the child processes send their Mach port to the 27 // all its subprocesses, so let the child processes send their Mach port to the
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // this method (and release the lock afterwards). 84 // this method (and release the lock afterwards).
85 void FinalizePid(base::ProcessHandle pid, mach_port_t task_port); 85 void FinalizePid(base::ProcessHandle pid, mach_port_t task_port);
86 86
87 // Name used to identify a particular port broker. 87 // Name used to identify a particular port broker.
88 const std::string name_; 88 const std::string name_;
89 89
90 // The Mach port on which the server listens. 90 // The Mach port on which the server listens.
91 base::mac::ScopedMachReceiveRight server_port_; 91 base::mac::ScopedMachReceiveRight server_port_;
92 92
93 // The dispatch source and queue on which Mach messages will be received. 93 // The dispatch source and queue on which Mach messages will be received.
94 scoped_ptr<base::DispatchSourceMach> dispatch_source_; 94 std::unique_ptr<base::DispatchSourceMach> dispatch_source_;
95 95
96 // Stores mach info for every process in the broker. 96 // Stores mach info for every process in the broker.
97 typedef std::map<base::ProcessHandle, mach_port_t> MachMap; 97 typedef std::map<base::ProcessHandle, mach_port_t> MachMap;
98 MachMap mach_map_; 98 MachMap mach_map_;
99 99
100 // Mutex that guards |mach_map_|. 100 // Mutex that guards |mach_map_|.
101 mutable base::Lock lock_; 101 mutable base::Lock lock_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(MachPortBroker); 103 DISALLOW_COPY_AND_ASSIGN(MachPortBroker);
104 }; 104 };
105 105
106 } // namespace base 106 } // namespace base
107 107
108 #endif // BASE_MAC_MACH_PORT_BROKER_H_ 108 #endif // BASE_MAC_MACH_PORT_BROKER_H_
OLDNEW
« no previous file with comments | « base/mac/dispatch_source_mach_unittest.cc ('k') | base/mac/scoped_authorizationref.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698