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

Side by Side Diff: chrome/browser/mach_broker_mac.cc

Issue 466088: Revert 34146 - A place to store the pid>mach_port_t mapping.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/mach_broker_mac.h ('k') | chrome/browser/mach_broker_mac_unittest.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 (c) 2009 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 #include "chrome/browser/mach_broker_mac.h"
6
7 #include "base/logging.h"
8
9 // Constructor.
10 MachBroker::MachBroker() {}
11
12 // Returns the global MachBroker.
13 MachBroker* MachBroker::instance() {
14 return Singleton<MachBroker>::get();
15 }
16
17 // Returns the mach task belonging to |pid|.
18 mach_port_t MachBroker::MachTaskForPid(base::ProcessHandle pid) const {
19 AutoLock lock(lock_);
20 MachBroker::MachMap::const_iterator it = mach_map_.find(pid);
21 if (it == mach_map_.end())
22 return 0;
23 return it->second.mach_task_;
24 }
25
26 // Returns the mach host belonging to |pid|.
27 mach_port_t MachBroker::MachHostForPid(base::ProcessHandle pid) const {
28 AutoLock lock(lock_);
29 MachMap::const_iterator it = mach_map_.find(pid);
30 if (it == mach_map_.end())
31 return 0;
32 return it->second.mach_host_;
33 }
34
35 // Adds mach info for a given pid.
36 void MachBroker::RegisterPid(
37 base::ProcessHandle pid, const MachInfo& mach_info) {
38 AutoLock lock(lock_);
39 DCHECK(mach_map_.count(pid) == 0);
40 mach_map_[pid] = mach_info;
41 }
42
43 // Removes all mappings belonging to |pid| from the broker.
44 void MachBroker::Invalidate(base::ProcessHandle pid) {
45 AutoLock lock(lock_);
46 mach_map_.erase(pid);
47 }
OLDNEW
« no previous file with comments | « chrome/browser/mach_broker_mac.h ('k') | chrome/browser/mach_broker_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698