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 CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 5 #ifndef CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
6 #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 6 #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // WeakPtrFactory when creating callbacks that run on UI thread. See | 81 // WeakPtrFactory when creating callbacks that run on UI thread. See |
82 // session_manager_client.cc for examples. | 82 // session_manager_client.cc for examples. |
83 // | 83 // |
84 class CHROMEOS_EXPORT DBusThreadManager { | 84 class CHROMEOS_EXPORT DBusThreadManager { |
85 public: | 85 public: |
86 // Sets the global instance. Must be called before any calls to Get(). | 86 // Sets the global instance. Must be called before any calls to Get(). |
87 // We explicitly initialize and shut down the global object, rather than | 87 // We explicitly initialize and shut down the global object, rather than |
88 // making it a Singleton, to ensure clean startup and shutdown. | 88 // making it a Singleton, to ensure clean startup and shutdown. |
89 static void Initialize(); | 89 static void Initialize(); |
90 | 90 |
91 // Returns DBusThreadManagerSetter instance that allows tests to | 91 // Returns a DBusThreadManagerSetter instance that allows tests to |
92 // replace individual dbus clients with their own implementations. | 92 // replace individual D-Bus clients with their own implementations. |
| 93 // Also initializes the main DBusThreadManager for testing if necessary. |
93 static scoped_ptr<DBusThreadManagerSetter> GetSetterForTesting(); | 94 static scoped_ptr<DBusThreadManagerSetter> GetSetterForTesting(); |
94 | 95 |
95 // Returns true if DBusThreadManager has been initialized. Call this to | 96 // Returns true if DBusThreadManager has been initialized. Call this to |
96 // avoid initializing + shutting down DBusThreadManager more than once. | 97 // avoid initializing + shutting down DBusThreadManager more than once. |
97 static bool IsInitialized(); | 98 static bool IsInitialized(); |
98 | 99 |
99 // Destroys the global instance. | 100 // Destroys the global instance. |
100 static void Shutdown(); | 101 static void Shutdown(); |
101 | 102 |
102 // Gets the global instance. Initialize() must be called first. | 103 // Gets the global instance. Initialize() must be called first. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 friend class DBusThreadManager; | 239 friend class DBusThreadManager; |
239 | 240 |
240 DBusThreadManagerSetter(); | 241 DBusThreadManagerSetter(); |
241 | 242 |
242 DISALLOW_COPY_AND_ASSIGN(DBusThreadManagerSetter); | 243 DISALLOW_COPY_AND_ASSIGN(DBusThreadManagerSetter); |
243 }; | 244 }; |
244 | 245 |
245 } // namespace chromeos | 246 } // namespace chromeos |
246 | 247 |
247 #endif // CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 248 #endif // CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
OLD | NEW |