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

Side by Side Diff: chromeos/dbus/dbus_thread_manager.cc

Issue 166593005: Delete D-Bus clients before shutting down the system bus (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 10 months 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 | no next file » | 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) 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 #include "chromeos/dbus/dbus_thread_manager.h" 5 #include "chromeos/dbus/dbus_thread_manager.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chromeos/dbus/system_clock_client.h" 46 #include "chromeos/dbus/system_clock_client.h"
47 #include "chromeos/dbus/update_engine_client.h" 47 #include "chromeos/dbus/update_engine_client.h"
48 #include "dbus/bus.h" 48 #include "dbus/bus.h"
49 #include "dbus/dbus_statistics.h" 49 #include "dbus/dbus_statistics.h"
50 50
51 namespace chromeos { 51 namespace chromeos {
52 52
53 static DBusThreadManager* g_dbus_thread_manager = NULL; 53 static DBusThreadManager* g_dbus_thread_manager = NULL;
54 static DBusThreadManager* g_dbus_thread_manager_for_testing = NULL; 54 static DBusThreadManager* g_dbus_thread_manager_for_testing = NULL;
55 55
56 // The bundle of all D-Bus clients used in DBusThreadManagerImpl. The bundle
57 // is used to delete them at once in the right order before shutting down the
58 // system bus. See also the comment in the destructor of DBusThreadManagerImpl.
59 class DBusClientBundle {
60 public:
61 DBusClientBundle() {
62 DBusClientImplementationType client_type = REAL_DBUS_CLIENT_IMPLEMENTATION;
63 DBusClientImplementationType client_type_override = client_type;
64 // If --dbus-stub was requested, pass STUB to specific components;
65 // Many components like login are not useful with a stub implementation.
66 if (CommandLine::ForCurrentProcess()->HasSwitch(
67 chromeos::switches::kDbusStub)) {
68 client_type_override = STUB_DBUS_CLIENT_IMPLEMENTATION;
69 }
70
71 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create());
72 bluetooth_agent_manager_client_.reset(
73 BluetoothAgentManagerClient::Create());
74 bluetooth_device_client_.reset(BluetoothDeviceClient::Create());
75 bluetooth_input_client_.reset(BluetoothInputClient::Create());
76 bluetooth_profile_manager_client_.reset(
77 BluetoothProfileManagerClient::Create());
78 cras_audio_client_.reset(CrasAudioClient::Create());
79 cros_disks_client_.reset(CrosDisksClient::Create(client_type));
80 cryptohome_client_.reset(CryptohomeClient::Create());
81 debug_daemon_client_.reset(DebugDaemonClient::Create());
82 shill_manager_client_.reset(ShillManagerClient::Create());
83 shill_device_client_.reset(ShillDeviceClient::Create());
84 shill_ipconfig_client_.reset(ShillIPConfigClient::Create());
85 shill_service_client_.reset(ShillServiceClient::Create());
86 shill_profile_client_.reset(ShillProfileClient::Create());
87 gsm_sms_client_.reset(GsmSMSClient::Create());
88 image_burner_client_.reset(ImageBurnerClient::Create());
89 introspectable_client_.reset(IntrospectableClient::Create());
90 modem_messaging_client_.reset(ModemMessagingClient::Create());
91 // Create the NFC clients in the correct order based on their dependencies.
92 nfc_manager_client_.reset(NfcManagerClient::Create());
93 nfc_adapter_client_.reset(
94 NfcAdapterClient::Create(nfc_manager_client_.get()));
95 nfc_device_client_.reset(
96 NfcDeviceClient::Create(nfc_adapter_client_.get()));
97 nfc_tag_client_.reset(NfcTagClient::Create(nfc_adapter_client_.get()));
98 nfc_record_client_.reset(NfcRecordClient::Create(nfc_device_client_.get(),
99 nfc_tag_client_.get()));
100 permission_broker_client_.reset(PermissionBrokerClient::Create());
101 power_manager_client_.reset(
102 PowerManagerClient::Create(client_type_override));
103 session_manager_client_.reset(SessionManagerClient::Create(client_type));
104 sms_client_.reset(SMSClient::Create());
105 system_clock_client_.reset(SystemClockClient::Create());
106 update_engine_client_.reset(UpdateEngineClient::Create(client_type));
107 }
108
109 BluetoothAdapterClient* bluetooth_adapter_client() {
110 return bluetooth_adapter_client_.get();
111 }
112 BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
113 return bluetooth_agent_manager_client_.get();
114 }
115 BluetoothDeviceClient* bluetooth_device_client() {
116 return bluetooth_device_client_.get();
117 }
118 BluetoothInputClient* bluetooth_input_client() {
119 return bluetooth_input_client_.get();
120 }
121 BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
122 return bluetooth_profile_manager_client_.get();
123 }
124 CrasAudioClient* cras_audio_client() {
125 return cras_audio_client_.get();
126 }
127 CrosDisksClient* cros_disks_client() {
128 return cros_disks_client_.get();
129 }
130 CryptohomeClient* cryptohome_client() {
131 return cryptohome_client_.get();
132 }
133 DebugDaemonClient* debug_daemon_client() {
134 return debug_daemon_client_.get();
135 }
136 ShillDeviceClient* shill_device_client() {
137 return shill_device_client_.get();
138 }
139 ShillIPConfigClient* shill_ipconfig_client() {
140 return shill_ipconfig_client_.get();
141 }
142 ShillManagerClient* shill_manager_client() {
143 return shill_manager_client_.get();
144 }
145 ShillServiceClient* shill_service_client() {
146 return shill_service_client_.get();
147 }
148 ShillProfileClient* shill_profile_client() {
149 return shill_profile_client_.get();
150 }
151 GsmSMSClient* gsm_sms_client() {
152 return gsm_sms_client_.get();
153 }
154 ImageBurnerClient* image_burner_client() {
155 return image_burner_client_.get();
156 }
157 IntrospectableClient* introspectable_client() {
158 return introspectable_client_.get();
159 }
160 ModemMessagingClient* modem_messaging_client() {
161 return modem_messaging_client_.get();
162 }
163 NfcManagerClient* nfc_manager_client() {
164 return nfc_manager_client_.get();
165 }
166 NfcAdapterClient* nfc_adapter_client() {
167 return nfc_adapter_client_.get();
168 }
169 NfcDeviceClient* nfc_device_client() {
170 return nfc_device_client_.get();
171 }
172 NfcTagClient* nfc_tag_client() {
173 return nfc_tag_client_.get();
174 }
175 NfcRecordClient* nfc_record_client() {
176 return nfc_record_client_.get();
177 }
178 PermissionBrokerClient* permission_broker_client() {
179 return permission_broker_client_.get();
180 }
181 SystemClockClient* system_clock_client() {
182 return system_clock_client_.get();
183 }
184 PowerManagerClient* power_manager_client() {
185 return power_manager_client_.get();
186 }
187 SessionManagerClient* session_manager_client() {
188 return session_manager_client_.get();
189 }
190 SMSClient* sms_client() {
191 return sms_client_.get();
192 }
193 UpdateEngineClient* update_engine_client() {
194 return update_engine_client_.get();
195 }
196
197 private:
198 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
199 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
200 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
201 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
202 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
203 scoped_ptr<CrasAudioClient> cras_audio_client_;
204 scoped_ptr<CrosDisksClient> cros_disks_client_;
205 scoped_ptr<CryptohomeClient> cryptohome_client_;
206 scoped_ptr<DebugDaemonClient> debug_daemon_client_;
207 scoped_ptr<ShillDeviceClient> shill_device_client_;
208 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_;
209 scoped_ptr<ShillManagerClient> shill_manager_client_;
210 scoped_ptr<ShillServiceClient> shill_service_client_;
211 scoped_ptr<ShillProfileClient> shill_profile_client_;
212 scoped_ptr<GsmSMSClient> gsm_sms_client_;
213 scoped_ptr<ImageBurnerClient> image_burner_client_;
214 scoped_ptr<IntrospectableClient> introspectable_client_;
215 scoped_ptr<ModemMessagingClient> modem_messaging_client_;
216 // The declaration order for NFC client objects is important. See
217 // DBusThreadManager::CreateDefaultClients for the dependencies.
218 scoped_ptr<NfcManagerClient> nfc_manager_client_;
219 scoped_ptr<NfcAdapterClient> nfc_adapter_client_;
220 scoped_ptr<NfcDeviceClient> nfc_device_client_;
221 scoped_ptr<NfcTagClient> nfc_tag_client_;
222 scoped_ptr<NfcRecordClient> nfc_record_client_;
223 scoped_ptr<PermissionBrokerClient> permission_broker_client_;
224 scoped_ptr<SystemClockClient> system_clock_client_;
225 scoped_ptr<PowerManagerClient> power_manager_client_;
226 scoped_ptr<SessionManagerClient> session_manager_client_;
227 scoped_ptr<SMSClient> sms_client_;
228 scoped_ptr<UpdateEngineClient> update_engine_client_;
229
230 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle);
231 };
232
56 // The DBusThreadManager implementation used in production. 233 // The DBusThreadManager implementation used in production.
57 class DBusThreadManagerImpl : public DBusThreadManager { 234 class DBusThreadManagerImpl : public DBusThreadManager {
58 public: 235 public:
59 explicit DBusThreadManagerImpl() { 236 explicit DBusThreadManagerImpl() {
60 // Create the D-Bus thread. 237 // Create the D-Bus thread.
61 base::Thread::Options thread_options; 238 base::Thread::Options thread_options;
62 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; 239 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
63 dbus_thread_.reset(new base::Thread("D-Bus thread")); 240 dbus_thread_.reset(new base::Thread("D-Bus thread"));
64 dbus_thread_->StartWithOptions(thread_options); 241 dbus_thread_->StartWithOptions(thread_options);
65 242
66 // Create the connection to the system bus. 243 // Create the connection to the system bus.
67 dbus::Bus::Options system_bus_options; 244 dbus::Bus::Options system_bus_options;
68 system_bus_options.bus_type = dbus::Bus::SYSTEM; 245 system_bus_options.bus_type = dbus::Bus::SYSTEM;
69 system_bus_options.connection_type = dbus::Bus::PRIVATE; 246 system_bus_options.connection_type = dbus::Bus::PRIVATE;
70 system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); 247 system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy();
71 system_bus_ = new dbus::Bus(system_bus_options); 248 system_bus_ = new dbus::Bus(system_bus_options);
72 249
73 CreateDefaultClients(); 250 CreateDefaultClients();
74 } 251 }
75 252
76 virtual ~DBusThreadManagerImpl() { 253 virtual ~DBusThreadManagerImpl() {
77 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, 254 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_,
78 OnDBusThreadManagerDestroying(this)); 255 OnDBusThreadManagerDestroying(this));
79 256
257 // Delete all D-Bus clients before shutting down the system bus.
258 client_bundle_.reset();
259
80 // Shut down the bus. During the browser shutdown, it's ok to shut down 260 // Shut down the bus. During the browser shutdown, it's ok to shut down
81 // the bus synchronously. 261 // the bus synchronously.
82 system_bus_->ShutdownOnDBusThreadAndBlock(); 262 system_bus_->ShutdownOnDBusThreadAndBlock();
83 263
84 // Stop the D-Bus thread. 264 // Stop the D-Bus thread.
85 dbus_thread_->Stop(); 265 dbus_thread_->Stop();
86 } 266 }
87 267
88 // DBusThreadManager overrides: 268 // DBusThreadManager overrides:
89 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE { 269 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE {
90 DCHECK(observer); 270 DCHECK(observer);
91 observers_.AddObserver(observer); 271 observers_.AddObserver(observer);
92 } 272 }
93 273
94 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE { 274 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE {
95 DCHECK(observer); 275 DCHECK(observer);
96 observers_.RemoveObserver(observer); 276 observers_.RemoveObserver(observer);
97 } 277 }
98 278
99 virtual dbus::Bus* GetSystemBus() OVERRIDE { 279 virtual dbus::Bus* GetSystemBus() OVERRIDE {
100 return system_bus_.get(); 280 return system_bus_.get();
101 } 281 }
102 282
103 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { 283 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE {
104 return bluetooth_adapter_client_.get(); 284 return client_bundle_->bluetooth_adapter_client();
105 } 285 }
106 286
107 virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() 287 virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient()
108 OVERRIDE { 288 OVERRIDE {
109 return bluetooth_agent_manager_client_.get(); 289 return client_bundle_->bluetooth_agent_manager_client();
110 } 290 }
111 291
112 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { 292 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE {
113 return bluetooth_device_client_.get(); 293 return client_bundle_->bluetooth_device_client();
114 } 294 }
115 295
116 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE { 296 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE {
117 return bluetooth_input_client_.get(); 297 return client_bundle_->bluetooth_input_client();
118 } 298 }
119 299
120 virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() 300 virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient()
121 OVERRIDE { 301 OVERRIDE {
122 return bluetooth_profile_manager_client_.get(); 302 return client_bundle_->bluetooth_profile_manager_client();
123 } 303 }
124 304
125 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { 305 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE {
126 return cras_audio_client_.get(); 306 return client_bundle_->cras_audio_client();
127 } 307 }
128 308
129 virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE { 309 virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE {
130 return cros_disks_client_.get(); 310 return client_bundle_->cros_disks_client();
131 } 311 }
132 312
133 virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE { 313 virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE {
134 return cryptohome_client_.get(); 314 return client_bundle_->cryptohome_client();
135 } 315 }
136 316
137 virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE { 317 virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE {
138 return debug_daemon_client_.get(); 318 return client_bundle_->debug_daemon_client();
139 } 319 }
140 320
141 virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE { 321 virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE {
142 return shill_device_client_.get(); 322 return client_bundle_->shill_device_client();
143 } 323 }
144 324
145 virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE { 325 virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE {
146 return shill_ipconfig_client_.get(); 326 return client_bundle_->shill_ipconfig_client();
147 } 327 }
148 328
149 virtual ShillManagerClient* GetShillManagerClient() OVERRIDE { 329 virtual ShillManagerClient* GetShillManagerClient() OVERRIDE {
150 return shill_manager_client_.get(); 330 return client_bundle_->shill_manager_client();
151 } 331 }
152 332
153 virtual ShillServiceClient* GetShillServiceClient() OVERRIDE { 333 virtual ShillServiceClient* GetShillServiceClient() OVERRIDE {
154 return shill_service_client_.get(); 334 return client_bundle_->shill_service_client();
155 } 335 }
156 336
157 virtual ShillProfileClient* GetShillProfileClient() OVERRIDE { 337 virtual ShillProfileClient* GetShillProfileClient() OVERRIDE {
158 return shill_profile_client_.get(); 338 return client_bundle_->shill_profile_client();
159 } 339 }
160 340
161 virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE { 341 virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE {
162 return gsm_sms_client_.get(); 342 return client_bundle_->gsm_sms_client();
163 } 343 }
164 344
165 virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE { 345 virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE {
166 return image_burner_client_.get(); 346 return client_bundle_->image_burner_client();
167 } 347 }
168 348
169 virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE { 349 virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE {
170 return introspectable_client_.get(); 350 return client_bundle_->introspectable_client();
171 } 351 }
172 352
173 virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE { 353 virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE {
174 return modem_messaging_client_.get(); 354 return client_bundle_->modem_messaging_client();
175 } 355 }
176 356
177 virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE { 357 virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE {
178 return nfc_adapter_client_.get(); 358 return client_bundle_->nfc_adapter_client();
179 } 359 }
180 360
181 virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE { 361 virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE {
182 return nfc_device_client_.get(); 362 return client_bundle_->nfc_device_client();
183 } 363 }
184 364
185 virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE { 365 virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE {
186 return nfc_manager_client_.get(); 366 return client_bundle_->nfc_manager_client();
187 } 367 }
188 368
189 virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE { 369 virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE {
190 return nfc_record_client_.get(); 370 return client_bundle_->nfc_record_client();
191 } 371 }
192 372
193 virtual NfcTagClient* GetNfcTagClient() OVERRIDE { 373 virtual NfcTagClient* GetNfcTagClient() OVERRIDE {
194 return nfc_tag_client_.get(); 374 return client_bundle_->nfc_tag_client();
195 } 375 }
196 376
197 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE { 377 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE {
198 return permission_broker_client_.get(); 378 return client_bundle_->permission_broker_client();
199 } 379 }
200 380
201 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { 381 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE {
202 return power_manager_client_.get(); 382 return client_bundle_->power_manager_client();
383 }
384
385 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE {
386 return client_bundle_->session_manager_client();
387 }
388
389 virtual SMSClient* GetSMSClient() OVERRIDE {
390 return client_bundle_->sms_client();
391 }
392
393 virtual SystemClockClient* GetSystemClockClient() OVERRIDE {
394 return client_bundle_->system_clock_client();
395 }
396
397 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE {
398 return client_bundle_->update_engine_client();
203 } 399 }
204 400
205 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE { 401 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE {
206 return power_policy_controller_.get(); 402 return power_policy_controller_.get();
207 } 403 }
208 404
209 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE {
210 return session_manager_client_.get();
211 }
212
213 virtual SMSClient* GetSMSClient() OVERRIDE {
214 return sms_client_.get();
215 }
216
217 virtual SystemClockClient* GetSystemClockClient() OVERRIDE {
218 return system_clock_client_.get();
219 }
220
221 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE {
222 return update_engine_client_.get();
223 }
224
225 private: 405 private:
226 // Constructs all clients and stores them in the respective *_client_ member 406 // Constructs all clients and stores them in the respective *_client_ member
227 // variable. 407 // variable.
228 void CreateDefaultClients() { 408 void CreateDefaultClients() {
229 DBusClientImplementationType client_type = REAL_DBUS_CLIENT_IMPLEMENTATION; 409 client_bundle_.reset(new DBusClientBundle);
230 DBusClientImplementationType client_type_override =
231 REAL_DBUS_CLIENT_IMPLEMENTATION;
232 // If --dbus-stub was requested, pass STUB to specific components;
233 // Many components like login are not useful with a stub implementation.
234 if (CommandLine::ForCurrentProcess()->HasSwitch(
235 chromeos::switches::kDbusStub)) {
236 client_type_override = STUB_DBUS_CLIENT_IMPLEMENTATION;
237 }
238
239 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create());
240 bluetooth_agent_manager_client_.reset(
241 BluetoothAgentManagerClient::Create());
242 bluetooth_device_client_.reset(BluetoothDeviceClient::Create());
243 bluetooth_input_client_.reset(BluetoothInputClient::Create());
244 bluetooth_profile_manager_client_.reset(
245 BluetoothProfileManagerClient::Create());
246 cras_audio_client_.reset(CrasAudioClient::Create());
247 cros_disks_client_.reset(CrosDisksClient::Create(client_type));
248 cryptohome_client_.reset(CryptohomeClient::Create());
249 debug_daemon_client_.reset(DebugDaemonClient::Create());
250 shill_manager_client_.reset(ShillManagerClient::Create());
251 shill_device_client_.reset(ShillDeviceClient::Create());
252 shill_ipconfig_client_.reset(ShillIPConfigClient::Create());
253 shill_service_client_.reset(ShillServiceClient::Create());
254 shill_profile_client_.reset(ShillProfileClient::Create());
255 gsm_sms_client_.reset(GsmSMSClient::Create());
256 image_burner_client_.reset(ImageBurnerClient::Create());
257 introspectable_client_.reset(IntrospectableClient::Create());
258 modem_messaging_client_.reset(ModemMessagingClient::Create());
259 // Create the NFC clients in the correct order based on their dependencies.
260 nfc_manager_client_.reset(NfcManagerClient::Create());
261 nfc_adapter_client_.reset(
262 NfcAdapterClient::Create(nfc_manager_client_.get()));
263 nfc_device_client_.reset(
264 NfcDeviceClient::Create(nfc_adapter_client_.get()));
265 nfc_tag_client_.reset(NfcTagClient::Create(nfc_adapter_client_.get()));
266 nfc_record_client_.reset(NfcRecordClient::Create(nfc_device_client_.get(),
267 nfc_tag_client_.get()));
268 permission_broker_client_.reset(PermissionBrokerClient::Create());
269 power_manager_client_.reset(
270 PowerManagerClient::Create(client_type_override));
271 session_manager_client_.reset(SessionManagerClient::Create(client_type));
272 sms_client_.reset(SMSClient::Create());
273 system_clock_client_.reset(SystemClockClient::Create());
274 update_engine_client_.reset(UpdateEngineClient::Create(client_type));
275
276 power_policy_controller_.reset(new PowerPolicyController); 410 power_policy_controller_.reset(new PowerPolicyController);
277 } 411 }
278 412
279 // Note: Keep this before other members so they can call AddObserver() in 413 // Note: Keep this before other members so they can call AddObserver() in
280 // their c'tors. 414 // their c'tors.
281 ObserverList<DBusThreadManagerObserver> observers_; 415 ObserverList<DBusThreadManagerObserver> observers_;
282 416
283 scoped_ptr<base::Thread> dbus_thread_; 417 scoped_ptr<base::Thread> dbus_thread_;
284 scoped_refptr<dbus::Bus> system_bus_; 418 scoped_refptr<dbus::Bus> system_bus_;
hashimoto 2014/02/19 04:36:57 suggestion: How about putting |dbus_thread_| and |
satorux1 2014/02/19 05:11:35 If we create a bundle for |dbus_thread_| and |syst
hashimoto 2014/02/19 05:31:43 I meant to create a bundle for the thread and the
285 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; 419 scoped_ptr<DBusClientBundle> client_bundle_;
286 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
287 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
288 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
289 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
290 scoped_ptr<CrasAudioClient> cras_audio_client_;
291 scoped_ptr<CrosDisksClient> cros_disks_client_;
292 scoped_ptr<CryptohomeClient> cryptohome_client_;
293 scoped_ptr<DebugDaemonClient> debug_daemon_client_;
294 scoped_ptr<ShillDeviceClient> shill_device_client_;
295 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_;
296 scoped_ptr<ShillManagerClient> shill_manager_client_;
297 scoped_ptr<ShillServiceClient> shill_service_client_;
298 scoped_ptr<ShillProfileClient> shill_profile_client_;
299 scoped_ptr<GsmSMSClient> gsm_sms_client_;
300 scoped_ptr<ImageBurnerClient> image_burner_client_;
301 scoped_ptr<IntrospectableClient> introspectable_client_;
302 scoped_ptr<ModemMessagingClient> modem_messaging_client_;
303 // The declaration order for NFC client objects is important. See
304 // DBusThreadManager::CreateDefaultClients for the dependencies.
305 scoped_ptr<NfcManagerClient> nfc_manager_client_;
306 scoped_ptr<NfcAdapterClient> nfc_adapter_client_;
307 scoped_ptr<NfcDeviceClient> nfc_device_client_;
308 scoped_ptr<NfcTagClient> nfc_tag_client_;
309 scoped_ptr<NfcRecordClient> nfc_record_client_;
310 scoped_ptr<PermissionBrokerClient> permission_broker_client_;
311 scoped_ptr<SystemClockClient> system_clock_client_;
312 scoped_ptr<PowerManagerClient> power_manager_client_;
313 scoped_ptr<SessionManagerClient> session_manager_client_;
314 scoped_ptr<SMSClient> sms_client_;
315 scoped_ptr<UpdateEngineClient> update_engine_client_;
316
317 scoped_ptr<PowerPolicyController> power_policy_controller_; 420 scoped_ptr<PowerPolicyController> power_policy_controller_;
318 }; 421 };
319 422
320 // static 423 // static
321 void DBusThreadManager::Initialize() { 424 void DBusThreadManager::Initialize() {
322 // If we initialize DBusThreadManager twice we may also be shutting it down 425 // If we initialize DBusThreadManager twice we may also be shutting it down
323 // early; do not allow that. 426 // early; do not allow that.
324 CHECK(g_dbus_thread_manager == NULL); 427 CHECK(g_dbus_thread_manager == NULL);
325 428
326 if (g_dbus_thread_manager_for_testing) { 429 if (g_dbus_thread_manager_for_testing) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 g_dbus_thread_manager->GetSystemBus()->GetManagedObjects(); 562 g_dbus_thread_manager->GetSystemBus()->GetManagedObjects();
460 } 563 }
461 564
462 // static 565 // static
463 void DBusThreadManager::InitClient(DBusClient* client) { 566 void DBusThreadManager::InitClient(DBusClient* client) {
464 if (client) 567 if (client)
465 client->Init(g_dbus_thread_manager->GetSystemBus()); 568 client->Init(g_dbus_thread_manager->GetSystemBus());
466 } 569 }
467 570
468 } // namespace chromeos 571 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698