| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_MACH_BROKER_MAC_H_ | 5 #ifndef CONTENT_BROWSER_MACH_BROKER_MAC_H_ |
| 6 #define CONTENT_BROWSER_MACH_BROKER_MAC_H_ | 6 #define CONTENT_BROWSER_MACH_BROKER_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 base::Lock& GetLock(); | 73 base::Lock& GetLock(); |
| 74 | 74 |
| 75 // Returns the Mach port name to use when sending or receiving messages. | 75 // Returns the Mach port name to use when sending or receiving messages. |
| 76 // Does the Right Thing in the browser and in child processes. | 76 // Does the Right Thing in the browser and in child processes. |
| 77 static std::string GetMachPortName(); | 77 static std::string GetMachPortName(); |
| 78 | 78 |
| 79 // Implement |ProcessMetrics::PortProvider|. | 79 // Implement |ProcessMetrics::PortProvider|. |
| 80 virtual mach_port_t TaskForPid(base::ProcessHandle process) const; | 80 virtual mach_port_t TaskForPid(base::ProcessHandle process) const; |
| 81 | 81 |
| 82 // Implement |NotificationObserver|. | 82 // Implement |NotificationObserver|. |
| 83 virtual void Observe(NotificationType type, | 83 virtual void Observe(int type, |
| 84 const NotificationSource& source, | 84 const NotificationSource& source, |
| 85 const NotificationDetails& details); | 85 const NotificationDetails& details); |
| 86 private: | 86 private: |
| 87 // Private constructor. | 87 // Private constructor. |
| 88 MachBroker(); | 88 MachBroker(); |
| 89 virtual ~MachBroker(); | 89 virtual ~MachBroker(); |
| 90 | 90 |
| 91 // True if the listener thread has been started. | 91 // True if the listener thread has been started. |
| 92 bool listener_thread_started_; | 92 bool listener_thread_started_; |
| 93 | 93 |
| 94 // Used to register for notifications received by NotificationObserver. | 94 // Used to register for notifications received by NotificationObserver. |
| 95 // Accessed only on the UI thread. | 95 // Accessed only on the UI thread. |
| 96 NotificationRegistrar registrar_; | 96 NotificationRegistrar registrar_; |
| 97 | 97 |
| 98 // Stores mach info for every process in the broker. | 98 // Stores mach info for every process in the broker. |
| 99 typedef std::map<base::ProcessHandle, MachInfo> MachMap; | 99 typedef std::map<base::ProcessHandle, MachInfo> MachMap; |
| 100 MachMap mach_map_; | 100 MachMap mach_map_; |
| 101 | 101 |
| 102 // Mutex that guards |mach_map_|. | 102 // Mutex that guards |mach_map_|. |
| 103 mutable base::Lock lock_; | 103 mutable base::Lock lock_; |
| 104 | 104 |
| 105 friend class MachBrokerTest; | 105 friend class MachBrokerTest; |
| 106 friend class RegisterNotificationTask; | 106 friend class RegisterNotificationTask; |
| 107 // Needed in order to make the constructor private. | 107 // Needed in order to make the constructor private. |
| 108 friend struct DefaultSingletonTraits<MachBroker>; | 108 friend struct DefaultSingletonTraits<MachBroker>; |
| 109 DISALLOW_COPY_AND_ASSIGN(MachBroker); | 109 DISALLOW_COPY_AND_ASSIGN(MachBroker); |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 #endif // CONTENT_BROWSER_MACH_BROKER_MAC_H_ | 112 #endif // CONTENT_BROWSER_MACH_BROKER_MAC_H_ |
| OLD | NEW |