OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // method (and release the lock afterwards). | 57 // method (and release the lock afterwards). |
58 void EnsureRunning(); | 58 void EnsureRunning(); |
59 | 59 |
60 // Adds a placeholder to the map for the given pid with MACH_PORT_NULL. | 60 // Adds a placeholder to the map for the given pid with MACH_PORT_NULL. |
61 // Callers are expected to later update the port with FinalizePid(). Callers | 61 // Callers are expected to later update the port with FinalizePid(). Callers |
62 // MUST acquire the lock given by GetLock() before calling this method (and | 62 // MUST acquire the lock given by GetLock() before calling this method (and |
63 // release the lock afterwards). | 63 // release the lock afterwards). |
64 void AddPlaceholderForPid(base::ProcessHandle pid); | 64 void AddPlaceholderForPid(base::ProcessHandle pid); |
65 | 65 |
66 // Implement |ProcessMetrics::PortProvider|. | 66 // Implement |ProcessMetrics::PortProvider|. |
67 virtual mach_port_t TaskForPid(base::ProcessHandle process) const override; | 67 mach_port_t TaskForPid(base::ProcessHandle process) const override; |
68 | 68 |
69 // Implement |BrowserChildProcessObserver|. | 69 // Implement |BrowserChildProcessObserver|. |
70 virtual void BrowserChildProcessHostDisconnected( | 70 void BrowserChildProcessHostDisconnected( |
71 const ChildProcessData& data) override; | 71 const ChildProcessData& data) override; |
72 virtual void BrowserChildProcessCrashed( | 72 void BrowserChildProcessCrashed(const ChildProcessData& data) override; |
73 const ChildProcessData& data) override; | |
74 | 73 |
75 // Implement |NotificationObserver|. | 74 // Implement |NotificationObserver|. |
76 virtual void Observe(int type, | 75 void Observe(int type, |
77 const NotificationSource& source, | 76 const NotificationSource& source, |
78 const NotificationDetails& details) override; | 77 const NotificationDetails& details) override; |
| 78 |
79 private: | 79 private: |
80 friend class MachBrokerTest; | 80 friend class MachBrokerTest; |
81 friend class MachListenerThreadDelegate; | 81 friend class MachListenerThreadDelegate; |
82 friend struct DefaultSingletonTraits<MachBroker>; | 82 friend struct DefaultSingletonTraits<MachBroker>; |
83 | 83 |
84 MachBroker(); | 84 MachBroker(); |
85 virtual ~MachBroker(); | 85 ~MachBroker() override; |
86 | 86 |
87 // Updates the mapping for |pid| to include the given |mach_info|. Does | 87 // Updates the mapping for |pid| to include the given |mach_info|. Does |
88 // nothing if PlaceholderForPid() has not already been called for the given | 88 // nothing if PlaceholderForPid() has not already been called for the given |
89 // |pid|. Callers MUST acquire the lock given by GetLock() before calling | 89 // |pid|. Callers MUST acquire the lock given by GetLock() before calling |
90 // this method (and release the lock afterwards). | 90 // this method (and release the lock afterwards). |
91 void FinalizePid(base::ProcessHandle pid, mach_port_t task_port); | 91 void FinalizePid(base::ProcessHandle pid, mach_port_t task_port); |
92 | 92 |
93 // Removes all mappings belonging to |pid| from the broker. | 93 // Removes all mappings belonging to |pid| from the broker. |
94 void InvalidatePid(base::ProcessHandle pid); | 94 void InvalidatePid(base::ProcessHandle pid); |
95 | 95 |
(...skipping 16 matching lines...) Expand all Loading... |
112 | 112 |
113 // Mutex that guards |mach_map_|. | 113 // Mutex that guards |mach_map_|. |
114 mutable base::Lock lock_; | 114 mutable base::Lock lock_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(MachBroker); | 116 DISALLOW_COPY_AND_ASSIGN(MachBroker); |
117 }; | 117 }; |
118 | 118 |
119 } // namespace content | 119 } // namespace content |
120 | 120 |
121 #endif // CONTENT_BROWSER_MACH_BROKER_MAC_H_ | 121 #endif // CONTENT_BROWSER_MACH_BROKER_MAC_H_ |
OLD | NEW |