Index: chrome/browser/mach_broker_mac.h |
diff --git a/chrome/browser/mach_broker_mac.h b/chrome/browser/mach_broker_mac.h |
index 67f4fec48712c9529d84980eb2ad48f45a73e37b..1827fc930c18d8eaa78fedb161770ba933ef6815 100644 |
--- a/chrome/browser/mach_broker_mac.h |
+++ b/chrome/browser/mach_broker_mac.h |
@@ -13,6 +13,7 @@ |
#include "base/process.h" |
#include "base/process_util.h" |
#include "base/singleton.h" |
+#include "chrome/common/notification_registrar.h" |
// On OS X, the mach_port_t of a process is required to collect metrics about |
// the process. Running |task_for_pid()| is only allowed for privileged code. |
@@ -28,7 +29,8 @@ |
// |
// Since this data arrives over a separate channel, it is not available |
// immediately after a child process has been started. |
-class MachBroker : public base::ProcessMetrics::PortProvider { |
+class MachBroker : public base::ProcessMetrics::PortProvider, |
+ public NotificationObserver { |
public: |
// Returns the global MachBroker. |
static MachBroker* instance(); |
@@ -53,9 +55,18 @@ class MachBroker : public base::ProcessMetrics::PortProvider { |
// Implement |ProcessMetrics::PortProvider|. |
virtual mach_port_t TaskForPid(base::ProcessHandle process) const; |
+ // Implement |NotificationObserver|. |
+ virtual void Observe(NotificationType type, |
+ const NotificationSource& source, |
+ const NotificationDetails& details); |
private: |
// Private constructor. |
- MachBroker() {} |
+ MachBroker(); |
+ |
+ // Used to register for notifications received by NotificationObserver. |
+ // Accessed only on the UI thread. |
+ NotificationRegistrar registrar_; |
+ |
friend struct DefaultSingletonTraits<MachBroker>; |
friend class MachBrokerTest; |
@@ -66,6 +77,7 @@ class MachBroker : public base::ProcessMetrics::PortProvider { |
// Mutex that guards |mach_map_|. |
mutable Lock lock_; |
+ friend class RegisterNotificationTask; |
DISALLOW_COPY_AND_ASSIGN(MachBroker); |
}; |