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

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

Issue 501138: Mac: Create a pid->task_t mapping in the browser process. (Closed)
Patch Set: trunglify 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
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 // Returns the global MachBroker.
10 MachBroker* MachBroker::instance() {
11 return Singleton<MachBroker>::get();
12 }
13
14 // Adds mach info for a given pid.
15 void MachBroker::RegisterPid(
16 base::ProcessHandle pid, const MachInfo& mach_info) {
17 AutoLock lock(lock_);
18 DCHECK_EQ(0u, mach_map_.count(pid));
19 mach_map_[pid] = mach_info;
20 }
21
22 // Removes all mappings belonging to |pid| from the broker.
23 void MachBroker::Invalidate(base::ProcessHandle pid) {
24 AutoLock lock(lock_);
25 mach_map_.erase(pid);
26 }
27
28 // Returns the mach task belonging to |pid|.
29 mach_port_t MachBroker::TaskForPid(base::ProcessHandle pid) const {
30 AutoLock lock(lock_);
31 MachBroker::MachMap::const_iterator it = mach_map_.find(pid);
32 if (it == mach_map_.end())
33 return MACH_PORT_NULL;
34 return it->second.mach_task_;
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698