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

Unified Diff: chrome/browser/mach_broker_mac.h

Issue 549002: Mac: Other approach for IPCing child task_ts. (Closed)
Patch Set: '' Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/child_process_launcher.cc ('k') | chrome/browser/mach_broker_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « chrome/browser/child_process_launcher.cc ('k') | chrome/browser/mach_broker_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698