| 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 CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class Thread; | 13 class Thread; |
| 14 }; | 14 }; |
| 15 | 15 |
| 16 namespace dbus { | 16 namespace dbus { |
| 17 class Bus; | 17 class Bus; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 class CrosDBusService; | 22 class CrosDBusService; |
| 23 class PowerManagerClient; | 23 class PowerManagerClient; |
| 24 class SensorsSource; | 24 class SensorsSource; |
| 25 class SpeechSynthesizerClient; |
| 25 | 26 |
| 26 // DBusThreadManager manages the D-Bus thread, the thread dedicated to | 27 // DBusThreadManager manages the D-Bus thread, the thread dedicated to |
| 27 // handling asynchronous D-Bus operations. | 28 // handling asynchronous D-Bus operations. |
| 28 // | 29 // |
| 29 // This class also manages D-Bus connections and D-Bus clients, which | 30 // This class also manages D-Bus connections and D-Bus clients, which |
| 30 // depend on the D-Bus thread to ensure the right order of shutdowns for | 31 // depend on the D-Bus thread to ensure the right order of shutdowns for |
| 31 // the D-Bus thread, the D-Bus connections, and the D-Bus clients. | 32 // the D-Bus thread, the D-Bus connections, and the D-Bus clients. |
| 32 // | 33 // |
| 33 // CALLBACKS IN D-BUS CLIENTS: | 34 // CALLBACKS IN D-BUS CLIENTS: |
| 34 // | 35 // |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 // Gets the global instance. Initialize() must be called first. | 55 // Gets the global instance. Initialize() must be called first. |
| 55 static DBusThreadManager* Get(); | 56 static DBusThreadManager* Get(); |
| 56 | 57 |
| 57 // Returns the power manager client, owned by DBusThreadManager. | 58 // Returns the power manager client, owned by DBusThreadManager. |
| 58 // Do not cache this pointer and use it after DBusThreadManager is shut | 59 // Do not cache this pointer and use it after DBusThreadManager is shut |
| 59 // down. | 60 // down. |
| 60 PowerManagerClient* power_manager_client() { | 61 PowerManagerClient* power_manager_client() { |
| 61 return power_manager_client_.get(); | 62 return power_manager_client_.get(); |
| 62 } | 63 } |
| 63 | 64 |
| 65 // Returns the speech synthesizer client, owned by DBusThreadManager. |
| 66 // Do not cache this pointer and use it after DBusThreadManager is shut |
| 67 // down. |
| 68 SpeechSynthesizerClient* speech_synthesizer_client() { |
| 69 return speech_synthesizer_client_.get(); |
| 70 } |
| 71 |
| 64 private: | 72 private: |
| 65 DBusThreadManager(); | 73 DBusThreadManager(); |
| 66 virtual ~DBusThreadManager(); | 74 virtual ~DBusThreadManager(); |
| 67 | 75 |
| 68 scoped_ptr<base::Thread> dbus_thread_; | 76 scoped_ptr<base::Thread> dbus_thread_; |
| 69 scoped_refptr<dbus::Bus> system_bus_; | 77 scoped_refptr<dbus::Bus> system_bus_; |
| 70 CrosDBusService* cros_dbus_service_; | 78 CrosDBusService* cros_dbus_service_; |
| 71 scoped_ptr<SensorsSource> sensors_source_; | 79 scoped_ptr<SensorsSource> sensors_source_; |
| 72 scoped_ptr<PowerManagerClient> power_manager_client_; | 80 scoped_ptr<PowerManagerClient> power_manager_client_; |
| 81 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; |
| 73 | 82 |
| 74 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); | 83 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); |
| 75 }; | 84 }; |
| 76 | 85 |
| 77 } // namespace chromeos | 86 } // namespace chromeos |
| 78 | 87 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 88 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
| OLD | NEW |