| 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 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // the regular IPC system uses. Hence, the child processes open a Mach | 29 // the regular IPC system uses. Hence, the child processes open a Mach |
| 30 // connection shortly after launching and ipc their mach data to the browser | 30 // connection shortly after launching and ipc their mach data to the browser |
| 31 // process. This data is kept in a global |MachBroker| object. | 31 // process. This data is kept in a global |MachBroker| object. |
| 32 // | 32 // |
| 33 // Since this data arrives over a separate channel, it is not available | 33 // Since this data arrives over a separate channel, it is not available |
| 34 // immediately after a child process has been started. | 34 // immediately after a child process has been started. |
| 35 class MachBroker : public base::ProcessMetrics::PortProvider, | 35 class MachBroker : public base::ProcessMetrics::PortProvider, |
| 36 public NotificationObserver { | 36 public NotificationObserver { |
| 37 public: | 37 public: |
| 38 // Returns the global MachBroker. | 38 // Returns the global MachBroker. |
| 39 static MachBroker* instance(); | 39 static MachBroker* GetInstance(); |
| 40 | 40 |
| 41 // Performs any necessary setup that cannot happen in the constructor. | 41 // Performs any necessary setup that cannot happen in the constructor. |
| 42 // Clients MUST call this method before fork()ing any children. | 42 // Clients MUST call this method before fork()ing any children. |
| 43 void PrepareForFork(); | 43 void PrepareForFork(); |
| 44 | 44 |
| 45 struct MachInfo { | 45 struct MachInfo { |
| 46 MachInfo() : mach_task_(MACH_PORT_NULL) {} | 46 MachInfo() : mach_task_(MACH_PORT_NULL) {} |
| 47 | 47 |
| 48 MachInfo& SetTask(mach_port_t task) { | 48 MachInfo& SetTask(mach_port_t task) { |
| 49 mach_task_ = task; | 49 mach_task_ = task; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 friend class MachBrokerTest; | 104 friend class MachBrokerTest; |
| 105 friend class RegisterNotificationTask; | 105 friend class RegisterNotificationTask; |
| 106 // Needed in order to make the constructor private. | 106 // Needed in order to make the constructor private. |
| 107 friend struct DefaultSingletonTraits<MachBroker>; | 107 friend struct DefaultSingletonTraits<MachBroker>; |
| 108 DISALLOW_COPY_AND_ASSIGN(MachBroker); | 108 DISALLOW_COPY_AND_ASSIGN(MachBroker); |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 #endif // CHROME_BROWSER_MACH_BROKER_H_ | 111 #endif // CHROME_BROWSER_MACH_BROKER_H_ |
| 112 | 112 |
| OLD | NEW |