OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_MACH_BROKER_H_ | 5 #ifndef CHROME_BROWSER_MACH_BROKER_H_ |
6 #define CHROME_BROWSER_MACH_BROKER_H_ | 6 #define CHROME_BROWSER_MACH_BROKER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include <mach/mach.h> | 11 #include <mach/mach.h> |
12 | 12 |
13 #include "base/lock.h" | 13 #include "base/lock.h" |
14 #include "base/process.h" | 14 #include "base/process.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/singleton.h" | 16 #include "base/singleton.h" |
| 17 #include "chrome/common/notification_observer.h" |
17 #include "chrome/common/notification_registrar.h" | 18 #include "chrome/common/notification_registrar.h" |
18 | 19 |
19 // On OS X, the mach_port_t of a process is required to collect metrics about | 20 // On OS X, the mach_port_t of a process is required to collect metrics about |
20 // the process. Running |task_for_pid()| is only allowed for privileged code. | 21 // the process. Running |task_for_pid()| is only allowed for privileged code. |
21 // However, a process has port rights to all its subprocesses, so let the | 22 // However, a process has port rights to all its subprocesses, so let the |
22 // browser's child processes send their Mach port to the browser over IPC. | 23 // browser's child processes send their Mach port to the browser over IPC. |
23 // This way, the brower can at least collect metrics of its child processes, | 24 // This way, the brower can at least collect metrics of its child processes, |
24 // which is what it's most interested in anyway. | 25 // which is what it's most interested in anyway. |
25 // | 26 // |
26 // Mach ports can only be sent over Mach IPC, not over the |socketpair()| that | 27 // Mach ports can only be sent over Mach IPC, not over the |socketpair()| that |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 // Mutex that guards |mach_map_|. | 79 // Mutex that guards |mach_map_|. |
79 mutable Lock lock_; | 80 mutable Lock lock_; |
80 | 81 |
81 friend class RegisterNotificationTask; | 82 friend class RegisterNotificationTask; |
82 DISALLOW_COPY_AND_ASSIGN(MachBroker); | 83 DISALLOW_COPY_AND_ASSIGN(MachBroker); |
83 }; | 84 }; |
84 | 85 |
85 #endif // CHROME_BROWSER_MACH_BROKER_H_ | 86 #endif // CHROME_BROWSER_MACH_BROKER_H_ |
86 | 87 |
OLD | NEW |