Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: chrome/browser/chromeos/dbus/dbus_thread_manager.h

Issue 8341073: chromeos: Use scoped_ptr for CrosDBusService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/dbus/dbus_thread_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 21 matching lines...) Expand all
32 // 32 //
33 // This class also manages D-Bus connections and D-Bus clients, which 33 // This class also manages D-Bus connections and D-Bus clients, which
34 // depend on the D-Bus thread to ensure the right order of shutdowns for 34 // depend on the D-Bus thread to ensure the right order of shutdowns for
35 // the D-Bus thread, the D-Bus connections, and the D-Bus clients. 35 // the D-Bus thread, the D-Bus connections, and the D-Bus clients.
36 // 36 //
37 // CALLBACKS IN D-BUS CLIENTS: 37 // CALLBACKS IN D-BUS CLIENTS:
38 // 38 //
39 // D-Bus clients managed by DBusThreadManager are guaranteed to be deleted 39 // D-Bus clients managed by DBusThreadManager are guaranteed to be deleted
40 // after the D-Bus thread so the clients don't need to worry if new 40 // after the D-Bus thread so the clients don't need to worry if new
41 // incoming messages arrive from the D-Bus thread during shutdown of the 41 // incoming messages arrive from the D-Bus thread during shutdown of the
42 // clients. However, the UI message loop may still be running during the 42 // clients. The UI message loop is not running during the shutdown hence
43 // shutdown, hence the D-Bus clients should inherit 43 // the UI message loop won't post tasks to D-BUS clients during the
44 // base::RefCountedThreadSafe if they export methods or call methods, to 44 // shutdown. However, to be extra cautious, clients should use
45 // ensure that callbacks can reference |this| safely on the UI thread 45 // WeakPtrFactory when creating callbacks that run on UI thread. See
46 // during the shutdown. 46 // session_manager_client.cc for examples.
47 // 47 //
48 class DBusThreadManager { 48 class DBusThreadManager {
49 public: 49 public:
50 // Sets the global instance. Must be called before any calls to Get(). 50 // Sets the global instance. Must be called before any calls to Get().
51 // We explicitly initialize and shut down the global object, rather than 51 // We explicitly initialize and shut down the global object, rather than
52 // making it a Singleton, to ensure clean startup and shutdown. 52 // making it a Singleton, to ensure clean startup and shutdown.
53 static void Initialize(); 53 static void Initialize();
54 54
55 // Destroys the global instance. 55 // Destroys the global instance.
56 static void Shutdown(); 56 static void Shutdown();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 SpeechSynthesizerClient* speech_synthesizer_client() { 96 SpeechSynthesizerClient* speech_synthesizer_client() {
97 return speech_synthesizer_client_.get(); 97 return speech_synthesizer_client_.get();
98 } 98 }
99 99
100 private: 100 private:
101 DBusThreadManager(); 101 DBusThreadManager();
102 virtual ~DBusThreadManager(); 102 virtual ~DBusThreadManager();
103 103
104 scoped_ptr<base::Thread> dbus_thread_; 104 scoped_ptr<base::Thread> dbus_thread_;
105 scoped_refptr<dbus::Bus> system_bus_; 105 scoped_refptr<dbus::Bus> system_bus_;
106 CrosDBusService* cros_dbus_service_; 106 scoped_ptr<CrosDBusService> cros_dbus_service_;
107 scoped_ptr<SensorsSource> sensors_source_; 107 scoped_ptr<SensorsSource> sensors_source_;
108 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_; 108 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
109 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; 109 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
110 scoped_ptr<PowerManagerClient> power_manager_client_; 110 scoped_ptr<PowerManagerClient> power_manager_client_;
111 scoped_ptr<SessionManagerClient> session_manager_client_; 111 scoped_ptr<SessionManagerClient> session_manager_client_;
112 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; 112 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_;
113 113
114 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); 114 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager);
115 }; 115 };
116 116
117 } // namespace chromeos 117 } // namespace chromeos
118 118
119 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ 119 #endif // CHROME_BROWSER_CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/dbus/dbus_thread_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698