Chromium Code Reviews| 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 #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 Loading... | |
| 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 struct DBusClientBundle { | |
|
stevenjb
2014/02/18 17:37:03
Since this has non-trivial behavior we should make
satorux1
2014/02/19 04:16:31
Done.
| |
| 60 DBusClientBundle() { | |
| 61 DBusClientImplementationType client_type = REAL_DBUS_CLIENT_IMPLEMENTATION; | |
| 62 DBusClientImplementationType client_type_override = | |
| 63 REAL_DBUS_CLIENT_IMPLEMENTATION; | |
|
stevenjb
2014/02/18 17:37:03
= client_type might be more clear?
satorux1
2014/02/19 04:16:31
Done.
| |
| 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 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client; | |
| 110 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client; | |
| 111 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client; | |
| 112 scoped_ptr<BluetoothInputClient> bluetooth_input_client; | |
| 113 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client; | |
| 114 scoped_ptr<CrasAudioClient> cras_audio_client; | |
| 115 scoped_ptr<CrosDisksClient> cros_disks_client; | |
| 116 scoped_ptr<CryptohomeClient> cryptohome_client; | |
| 117 scoped_ptr<DebugDaemonClient> debug_daemon_client; | |
| 118 scoped_ptr<ShillDeviceClient> shill_device_client; | |
| 119 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client; | |
| 120 scoped_ptr<ShillManagerClient> shill_manager_client; | |
| 121 scoped_ptr<ShillServiceClient> shill_service_client; | |
| 122 scoped_ptr<ShillProfileClient> shill_profile_client; | |
| 123 scoped_ptr<GsmSMSClient> gsm_sms_client; | |
| 124 scoped_ptr<ImageBurnerClient> image_burner_client; | |
| 125 scoped_ptr<IntrospectableClient> introspectable_client; | |
| 126 scoped_ptr<ModemMessagingClient> modem_messaging_client; | |
| 127 // The declaration order for NFC client objects is important. See | |
| 128 // DBusThreadManager::CreateDefaultClients for the dependencies. | |
| 129 scoped_ptr<NfcManagerClient> nfc_manager_client; | |
| 130 scoped_ptr<NfcAdapterClient> nfc_adapter_client; | |
| 131 scoped_ptr<NfcDeviceClient> nfc_device_client; | |
| 132 scoped_ptr<NfcTagClient> nfc_tag_client; | |
| 133 scoped_ptr<NfcRecordClient> nfc_record_client; | |
| 134 scoped_ptr<PermissionBrokerClient> permission_broker_client; | |
| 135 scoped_ptr<SystemClockClient> system_clock_client; | |
| 136 scoped_ptr<PowerManagerClient> power_manager_client; | |
| 137 scoped_ptr<SessionManagerClient> session_manager_client; | |
| 138 scoped_ptr<SMSClient> sms_client; | |
| 139 scoped_ptr<UpdateEngineClient> update_engine_client; | |
| 140 }; | |
| 141 | |
| 56 // The DBusThreadManager implementation used in production. | 142 // The DBusThreadManager implementation used in production. |
| 57 class DBusThreadManagerImpl : public DBusThreadManager { | 143 class DBusThreadManagerImpl : public DBusThreadManager { |
| 58 public: | 144 public: |
| 59 explicit DBusThreadManagerImpl() { | 145 explicit DBusThreadManagerImpl() { |
| 60 // Create the D-Bus thread. | 146 // Create the D-Bus thread. |
| 61 base::Thread::Options thread_options; | 147 base::Thread::Options thread_options; |
| 62 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 148 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 63 dbus_thread_.reset(new base::Thread("D-Bus thread")); | 149 dbus_thread_.reset(new base::Thread("D-Bus thread")); |
| 64 dbus_thread_->StartWithOptions(thread_options); | 150 dbus_thread_->StartWithOptions(thread_options); |
| 65 | 151 |
| 66 // Create the connection to the system bus. | 152 // Create the connection to the system bus. |
| 67 dbus::Bus::Options system_bus_options; | 153 dbus::Bus::Options system_bus_options; |
| 68 system_bus_options.bus_type = dbus::Bus::SYSTEM; | 154 system_bus_options.bus_type = dbus::Bus::SYSTEM; |
| 69 system_bus_options.connection_type = dbus::Bus::PRIVATE; | 155 system_bus_options.connection_type = dbus::Bus::PRIVATE; |
| 70 system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); | 156 system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); |
| 71 system_bus_ = new dbus::Bus(system_bus_options); | 157 system_bus_ = new dbus::Bus(system_bus_options); |
| 72 | 158 |
| 73 CreateDefaultClients(); | 159 CreateDefaultClients(); |
| 74 } | 160 } |
| 75 | 161 |
| 76 virtual ~DBusThreadManagerImpl() { | 162 virtual ~DBusThreadManagerImpl() { |
| 77 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, | 163 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, |
| 78 OnDBusThreadManagerDestroying(this)); | 164 OnDBusThreadManagerDestroying(this)); |
| 79 | 165 |
| 166 // Delete all D-Bus clients before shutting down the system bus. | |
| 167 client_bundle_.reset(); | |
| 168 | |
| 80 // Shut down the bus. During the browser shutdown, it's ok to shut down | 169 // Shut down the bus. During the browser shutdown, it's ok to shut down |
| 81 // the bus synchronously. | 170 // the bus synchronously. |
| 82 system_bus_->ShutdownOnDBusThreadAndBlock(); | 171 system_bus_->ShutdownOnDBusThreadAndBlock(); |
| 83 | 172 |
| 84 // Stop the D-Bus thread. | 173 // Stop the D-Bus thread. |
| 85 dbus_thread_->Stop(); | 174 dbus_thread_->Stop(); |
| 86 } | 175 } |
| 87 | 176 |
| 88 // DBusThreadManager overrides: | 177 // DBusThreadManager overrides: |
| 89 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE { | 178 virtual void AddObserver(DBusThreadManagerObserver* observer) OVERRIDE { |
| 90 DCHECK(observer); | 179 DCHECK(observer); |
| 91 observers_.AddObserver(observer); | 180 observers_.AddObserver(observer); |
| 92 } | 181 } |
| 93 | 182 |
| 94 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE { | 183 virtual void RemoveObserver(DBusThreadManagerObserver* observer) OVERRIDE { |
| 95 DCHECK(observer); | 184 DCHECK(observer); |
| 96 observers_.RemoveObserver(observer); | 185 observers_.RemoveObserver(observer); |
| 97 } | 186 } |
| 98 | 187 |
| 99 virtual dbus::Bus* GetSystemBus() OVERRIDE { | 188 virtual dbus::Bus* GetSystemBus() OVERRIDE { |
| 100 return system_bus_.get(); | 189 return system_bus_.get(); |
| 101 } | 190 } |
| 102 | 191 |
| 103 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { | 192 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { |
| 104 return bluetooth_adapter_client_.get(); | 193 return client_bundle_->bluetooth_adapter_client.get(); |
| 105 } | 194 } |
| 106 | 195 |
| 107 virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() | 196 virtual BluetoothAgentManagerClient* GetBluetoothAgentManagerClient() |
| 108 OVERRIDE { | 197 OVERRIDE { |
| 109 return bluetooth_agent_manager_client_.get(); | 198 return client_bundle_->bluetooth_agent_manager_client.get(); |
| 110 } | 199 } |
| 111 | 200 |
| 112 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { | 201 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { |
| 113 return bluetooth_device_client_.get(); | 202 return client_bundle_->bluetooth_device_client.get(); |
| 114 } | 203 } |
| 115 | 204 |
| 116 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE { | 205 virtual BluetoothInputClient* GetBluetoothInputClient() OVERRIDE { |
| 117 return bluetooth_input_client_.get(); | 206 return client_bundle_->bluetooth_input_client.get(); |
| 118 } | 207 } |
| 119 | 208 |
| 120 virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() | 209 virtual BluetoothProfileManagerClient* GetBluetoothProfileManagerClient() |
| 121 OVERRIDE { | 210 OVERRIDE { |
| 122 return bluetooth_profile_manager_client_.get(); | 211 return client_bundle_->bluetooth_profile_manager_client.get(); |
| 123 } | 212 } |
| 124 | 213 |
| 125 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { | 214 virtual CrasAudioClient* GetCrasAudioClient() OVERRIDE { |
| 126 return cras_audio_client_.get(); | 215 return client_bundle_->cras_audio_client.get(); |
| 127 } | 216 } |
| 128 | 217 |
| 129 virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE { | 218 virtual CrosDisksClient* GetCrosDisksClient() OVERRIDE { |
| 130 return cros_disks_client_.get(); | 219 return client_bundle_->cros_disks_client.get(); |
| 131 } | 220 } |
| 132 | 221 |
| 133 virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE { | 222 virtual CryptohomeClient* GetCryptohomeClient() OVERRIDE { |
| 134 return cryptohome_client_.get(); | 223 return client_bundle_->cryptohome_client.get(); |
| 135 } | 224 } |
| 136 | 225 |
| 137 virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE { | 226 virtual DebugDaemonClient* GetDebugDaemonClient() OVERRIDE { |
| 138 return debug_daemon_client_.get(); | 227 return client_bundle_->debug_daemon_client.get(); |
| 139 } | 228 } |
| 140 | 229 |
| 141 virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE { | 230 virtual ShillDeviceClient* GetShillDeviceClient() OVERRIDE { |
| 142 return shill_device_client_.get(); | 231 return client_bundle_->shill_device_client.get(); |
| 143 } | 232 } |
| 144 | 233 |
| 145 virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE { | 234 virtual ShillIPConfigClient* GetShillIPConfigClient() OVERRIDE { |
| 146 return shill_ipconfig_client_.get(); | 235 return client_bundle_->shill_ipconfig_client.get(); |
| 147 } | 236 } |
| 148 | 237 |
| 149 virtual ShillManagerClient* GetShillManagerClient() OVERRIDE { | 238 virtual ShillManagerClient* GetShillManagerClient() OVERRIDE { |
| 150 return shill_manager_client_.get(); | 239 return client_bundle_->shill_manager_client.get(); |
| 151 } | 240 } |
| 152 | 241 |
| 153 virtual ShillServiceClient* GetShillServiceClient() OVERRIDE { | 242 virtual ShillServiceClient* GetShillServiceClient() OVERRIDE { |
| 154 return shill_service_client_.get(); | 243 return client_bundle_->shill_service_client.get(); |
| 155 } | 244 } |
| 156 | 245 |
| 157 virtual ShillProfileClient* GetShillProfileClient() OVERRIDE { | 246 virtual ShillProfileClient* GetShillProfileClient() OVERRIDE { |
| 158 return shill_profile_client_.get(); | 247 return client_bundle_->shill_profile_client.get(); |
| 159 } | 248 } |
| 160 | 249 |
| 161 virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE { | 250 virtual GsmSMSClient* GetGsmSMSClient() OVERRIDE { |
| 162 return gsm_sms_client_.get(); | 251 return client_bundle_->gsm_sms_client.get(); |
| 163 } | 252 } |
| 164 | 253 |
| 165 virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE { | 254 virtual ImageBurnerClient* GetImageBurnerClient() OVERRIDE { |
| 166 return image_burner_client_.get(); | 255 return client_bundle_->image_burner_client.get(); |
| 167 } | 256 } |
| 168 | 257 |
| 169 virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE { | 258 virtual IntrospectableClient* GetIntrospectableClient() OVERRIDE { |
| 170 return introspectable_client_.get(); | 259 return client_bundle_->introspectable_client.get(); |
| 171 } | 260 } |
| 172 | 261 |
| 173 virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE { | 262 virtual ModemMessagingClient* GetModemMessagingClient() OVERRIDE { |
| 174 return modem_messaging_client_.get(); | 263 return client_bundle_->modem_messaging_client.get(); |
| 175 } | 264 } |
| 176 | 265 |
| 177 virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE { | 266 virtual NfcAdapterClient* GetNfcAdapterClient() OVERRIDE { |
| 178 return nfc_adapter_client_.get(); | 267 return client_bundle_->nfc_adapter_client.get(); |
| 179 } | 268 } |
| 180 | 269 |
| 181 virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE { | 270 virtual NfcDeviceClient* GetNfcDeviceClient() OVERRIDE { |
| 182 return nfc_device_client_.get(); | 271 return client_bundle_->nfc_device_client.get(); |
| 183 } | 272 } |
| 184 | 273 |
| 185 virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE { | 274 virtual NfcManagerClient* GetNfcManagerClient() OVERRIDE { |
| 186 return nfc_manager_client_.get(); | 275 return client_bundle_->nfc_manager_client.get(); |
| 187 } | 276 } |
| 188 | 277 |
| 189 virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE { | 278 virtual NfcRecordClient* GetNfcRecordClient() OVERRIDE { |
| 190 return nfc_record_client_.get(); | 279 return client_bundle_->nfc_record_client.get(); |
| 191 } | 280 } |
| 192 | 281 |
| 193 virtual NfcTagClient* GetNfcTagClient() OVERRIDE { | 282 virtual NfcTagClient* GetNfcTagClient() OVERRIDE { |
| 194 return nfc_tag_client_.get(); | 283 return client_bundle_->nfc_tag_client.get(); |
| 195 } | 284 } |
| 196 | 285 |
| 197 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE { | 286 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE { |
| 198 return permission_broker_client_.get(); | 287 return client_bundle_->permission_broker_client.get(); |
| 199 } | 288 } |
| 200 | 289 |
| 201 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { | 290 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { |
| 202 return power_manager_client_.get(); | 291 return client_bundle_->power_manager_client.get(); |
| 292 } | |
| 293 | |
| 294 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { | |
| 295 return client_bundle_->session_manager_client.get(); | |
| 296 } | |
| 297 | |
| 298 virtual SMSClient* GetSMSClient() OVERRIDE { | |
| 299 return client_bundle_->sms_client.get(); | |
| 300 } | |
| 301 | |
| 302 virtual SystemClockClient* GetSystemClockClient() OVERRIDE { | |
| 303 return client_bundle_->system_clock_client.get(); | |
| 304 } | |
| 305 | |
| 306 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE { | |
| 307 return client_bundle_->update_engine_client.get(); | |
| 203 } | 308 } |
| 204 | 309 |
| 205 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE { | 310 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE { |
| 206 return power_policy_controller_.get(); | 311 return power_policy_controller_.get(); |
| 207 } | 312 } |
| 208 | 313 |
| 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: | 314 private: |
| 226 // Constructs all clients and stores them in the respective *_client_ member | 315 // Constructs all clients and stores them in the respective *_client_ member |
| 227 // variable. | 316 // variable. |
| 228 void CreateDefaultClients() { | 317 void CreateDefaultClients() { |
| 229 DBusClientImplementationType client_type = REAL_DBUS_CLIENT_IMPLEMENTATION; | 318 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); | 319 power_policy_controller_.reset(new PowerPolicyController); |
| 277 } | 320 } |
| 278 | 321 |
| 279 // Note: Keep this before other members so they can call AddObserver() in | 322 // Note: Keep this before other members so they can call AddObserver() in |
| 280 // their c'tors. | 323 // their c'tors. |
| 281 ObserverList<DBusThreadManagerObserver> observers_; | 324 ObserverList<DBusThreadManagerObserver> observers_; |
| 282 | 325 |
| 283 scoped_ptr<base::Thread> dbus_thread_; | 326 scoped_ptr<base::Thread> dbus_thread_; |
| 284 scoped_refptr<dbus::Bus> system_bus_; | 327 scoped_refptr<dbus::Bus> system_bus_; |
| 285 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; | 328 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_; | 329 scoped_ptr<PowerPolicyController> power_policy_controller_; |
| 318 }; | 330 }; |
| 319 | 331 |
| 320 // static | 332 // static |
| 321 void DBusThreadManager::Initialize() { | 333 void DBusThreadManager::Initialize() { |
| 322 // If we initialize DBusThreadManager twice we may also be shutting it down | 334 // If we initialize DBusThreadManager twice we may also be shutting it down |
| 323 // early; do not allow that. | 335 // early; do not allow that. |
| 324 CHECK(g_dbus_thread_manager == NULL); | 336 CHECK(g_dbus_thread_manager == NULL); |
| 325 | 337 |
| 326 if (g_dbus_thread_manager_for_testing) { | 338 if (g_dbus_thread_manager_for_testing) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 459 g_dbus_thread_manager->GetSystemBus()->GetManagedObjects(); | 471 g_dbus_thread_manager->GetSystemBus()->GetManagedObjects(); |
| 460 } | 472 } |
| 461 | 473 |
| 462 // static | 474 // static |
| 463 void DBusThreadManager::InitClient(DBusClient* client) { | 475 void DBusThreadManager::InitClient(DBusClient* client) { |
| 464 if (client) | 476 if (client) |
| 465 client->Init(g_dbus_thread_manager->GetSystemBus()); | 477 client->Init(g_dbus_thread_manager->GetSystemBus()); |
| 466 } | 478 } |
| 467 | 479 |
| 468 } // namespace chromeos | 480 } // namespace chromeos |
| OLD | NEW |