| 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/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "chromeos/chromeos_switches.h" | 13 #include "chromeos/chromeos_switches.h" |
| 14 #include "chromeos/dbus/bluetooth_adapter_client.h" | 14 #include "chromeos/dbus/bluetooth_adapter_client.h" |
| 15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" | 15 #include "chromeos/dbus/bluetooth_agent_manager_client.h" |
| 16 #include "chromeos/dbus/bluetooth_device_client.h" | 16 #include "chromeos/dbus/bluetooth_device_client.h" |
| 17 #include "chromeos/dbus/bluetooth_input_client.h" | 17 #include "chromeos/dbus/bluetooth_input_client.h" |
| 18 #include "chromeos/dbus/bluetooth_profile_manager_client.h" | 18 #include "chromeos/dbus/bluetooth_profile_manager_client.h" |
| 19 #include "chromeos/dbus/cras_audio_client.h" | 19 #include "chromeos/dbus/cras_audio_client.h" |
| 20 #include "chromeos/dbus/cros_disks_client.h" | 20 #include "chromeos/dbus/cros_disks_client.h" |
| 21 #include "chromeos/dbus/cryptohome_client.h" | 21 #include "chromeos/dbus/cryptohome_client.h" |
| 22 #include "chromeos/dbus/dbus_client_implementation_type.h" | 22 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 23 #include "chromeos/dbus/dbus_thread_manager_observer.h" | 23 #include "chromeos/dbus/dbus_thread_manager_observer.h" |
| 24 #include "chromeos/dbus/debug_daemon_client.h" | 24 #include "chromeos/dbus/debug_daemon_client.h" |
| 25 #include "chromeos/dbus/gsm_sms_client.h" | 25 #include "chromeos/dbus/gsm_sms_client.h" |
| 26 #include "chromeos/dbus/shill_device_client.h" | |
| 27 #include "chromeos/dbus/shill_ipconfig_client.h" | |
| 28 #include "chromeos/dbus/shill_manager_client.h" | |
| 29 #include "chromeos/dbus/shill_profile_client.h" | |
| 30 #include "chromeos/dbus/shill_service_client.h" | |
| 31 #include "chromeos/dbus/system_clock_client.h" | |
| 32 #include "chromeos/dbus/ibus/ibus_client.h" | 26 #include "chromeos/dbus/ibus/ibus_client.h" |
| 33 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" | 27 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" |
| 34 #include "chromeos/dbus/ibus/ibus_engine_service.h" | 28 #include "chromeos/dbus/ibus/ibus_engine_service.h" |
| 35 #include "chromeos/dbus/ibus/ibus_input_context_client.h" | 29 #include "chromeos/dbus/ibus/ibus_input_context_client.h" |
| 36 #include "chromeos/dbus/image_burner_client.h" | 30 #include "chromeos/dbus/image_burner_client.h" |
| 37 #include "chromeos/dbus/introspectable_client.h" | 31 #include "chromeos/dbus/introspectable_client.h" |
| 38 #include "chromeos/dbus/modem_messaging_client.h" | 32 #include "chromeos/dbus/modem_messaging_client.h" |
| 39 #include "chromeos/dbus/permission_broker_client.h" | 33 #include "chromeos/dbus/permission_broker_client.h" |
| 40 #include "chromeos/dbus/power_manager_client.h" | 34 #include "chromeos/dbus/power_manager_client.h" |
| 41 #include "chromeos/dbus/power_policy_controller.h" | 35 #include "chromeos/dbus/power_policy_controller.h" |
| 42 #include "chromeos/dbus/session_manager_client.h" | 36 #include "chromeos/dbus/session_manager_client.h" |
| 37 #include "chromeos/dbus/shill_device_client.h" |
| 38 #include "chromeos/dbus/shill_ipconfig_client.h" |
| 39 #include "chromeos/dbus/shill_manager_client.h" |
| 40 #include "chromeos/dbus/shill_profile_client.h" |
| 41 #include "chromeos/dbus/shill_service_client.h" |
| 42 #include "chromeos/dbus/shill_test_helper.h" |
| 43 #include "chromeos/dbus/sms_client.h" | 43 #include "chromeos/dbus/sms_client.h" |
| 44 #include "chromeos/dbus/system_clock_client.h" |
| 44 #include "chromeos/dbus/update_engine_client.h" | 45 #include "chromeos/dbus/update_engine_client.h" |
| 45 #include "dbus/bus.h" | 46 #include "dbus/bus.h" |
| 46 #include "dbus/dbus_statistics.h" | 47 #include "dbus/dbus_statistics.h" |
| 47 | 48 |
| 48 namespace chromeos { | 49 namespace chromeos { |
| 49 | 50 |
| 50 static DBusThreadManager* g_dbus_thread_manager = NULL; | 51 static DBusThreadManager* g_dbus_thread_manager = NULL; |
| 51 static bool g_dbus_thread_manager_set_for_testing = false; | 52 static bool g_dbus_thread_manager_set_for_testing = false; |
| 52 | 53 |
| 53 // The DBusThreadManager implementation used in production. | 54 // The DBusThreadManager implementation used in production. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 void InitializeClients() { | 86 void InitializeClients() { |
| 86 InitClient(bluetooth_adapter_client_.get()); | 87 InitClient(bluetooth_adapter_client_.get()); |
| 87 InitClient(bluetooth_agent_manager_client_.get()); | 88 InitClient(bluetooth_agent_manager_client_.get()); |
| 88 InitClient(bluetooth_device_client_.get()); | 89 InitClient(bluetooth_device_client_.get()); |
| 89 InitClient(bluetooth_input_client_.get()); | 90 InitClient(bluetooth_input_client_.get()); |
| 90 InitClient(bluetooth_profile_manager_client_.get()); | 91 InitClient(bluetooth_profile_manager_client_.get()); |
| 91 InitClient(cras_audio_client_.get()); | 92 InitClient(cras_audio_client_.get()); |
| 92 InitClient(cros_disks_client_.get()); | 93 InitClient(cros_disks_client_.get()); |
| 93 InitClient(cryptohome_client_.get()); | 94 InitClient(cryptohome_client_.get()); |
| 94 InitClient(debug_daemon_client_.get()); | 95 InitClient(debug_daemon_client_.get()); |
| 95 | |
| 96 // Initialization order of the Stub implementations of the Shill clients | |
| 97 // matters; stub clients may only have initialization dependencies on | |
| 98 // clients previously initialized. | |
| 99 InitClient(shill_manager_client_.get()); | 96 InitClient(shill_manager_client_.get()); |
| 100 InitClient(shill_device_client_.get()); | 97 InitClient(shill_device_client_.get()); |
| 101 InitClient(shill_ipconfig_client_.get()); | 98 InitClient(shill_ipconfig_client_.get()); |
| 102 InitClient(shill_service_client_.get()); | 99 InitClient(shill_service_client_.get()); |
| 103 InitClient(shill_profile_client_.get()); | 100 InitClient(shill_profile_client_.get()); |
| 104 InitClient(gsm_sms_client_.get()); | 101 InitClient(gsm_sms_client_.get()); |
| 105 | |
| 106 // If the Service client has a TestInterface, add the default services. | |
| 107 ShillServiceClient::TestInterface* service_client_test = | |
| 108 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); | |
| 109 if (service_client_test) | |
| 110 service_client_test->AddDefaultServices(); | |
| 111 | |
| 112 InitClient(image_burner_client_.get()); | 102 InitClient(image_burner_client_.get()); |
| 113 InitClient(introspectable_client_.get()); | 103 InitClient(introspectable_client_.get()); |
| 114 InitClient(modem_messaging_client_.get()); | 104 InitClient(modem_messaging_client_.get()); |
| 115 InitClient(permission_broker_client_.get()); | 105 InitClient(permission_broker_client_.get()); |
| 116 InitClient(power_manager_client_.get()); | 106 InitClient(power_manager_client_.get()); |
| 117 InitClient(session_manager_client_.get()); | 107 InitClient(session_manager_client_.get()); |
| 118 InitClient(sms_client_.get()); | 108 InitClient(sms_client_.get()); |
| 119 InitClient(system_clock_client_.get()); | 109 InitClient(system_clock_client_.get()); |
| 120 InitClient(update_engine_client_.get()); | 110 InitClient(update_engine_client_.get()); |
| 121 | 111 |
| 122 // PowerPolicyController is dependent on PowerManagerClient, so | 112 // PowerPolicyController is dependent on PowerManagerClient, so |
| 123 // initialize it after the main list of clients. | 113 // initialize it after the main list of clients. |
| 124 power_policy_controller_.reset( | 114 power_policy_controller_.reset( |
| 125 new PowerPolicyController(this, power_manager_client_.get())); | 115 new PowerPolicyController(this, power_manager_client_.get())); |
| 126 | 116 |
| 117 shill_test_helper::SetupDefaultEnvironment(); |
| 118 |
| 127 // This must be called after the list of clients so they've each had a | 119 // This must be called after the list of clients so they've each had a |
| 128 // chance to register with their object managers. | 120 // chance to register with their object managers. |
| 129 system_bus_->GetManagedObjects(); | 121 system_bus_->GetManagedObjects(); |
| 130 } | 122 } |
| 131 | 123 |
| 132 virtual ~DBusThreadManagerImpl() { | 124 virtual ~DBusThreadManagerImpl() { |
| 133 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, | 125 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, |
| 134 OnDBusThreadManagerDestroying(this)); | 126 OnDBusThreadManagerDestroying(this)); |
| 135 | 127 |
| 136 // Shut down the bus. During the browser shutdown, it's ok to shut down | 128 // Shut down the bus. During the browser shutdown, it's ok to shut down |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 494 } |
| 503 | 495 |
| 504 // static | 496 // static |
| 505 DBusThreadManager* DBusThreadManager::Get() { | 497 DBusThreadManager* DBusThreadManager::Get() { |
| 506 CHECK(g_dbus_thread_manager) | 498 CHECK(g_dbus_thread_manager) |
| 507 << "DBusThreadManager::Get() called before Initialize()"; | 499 << "DBusThreadManager::Get() called before Initialize()"; |
| 508 return g_dbus_thread_manager; | 500 return g_dbus_thread_manager; |
| 509 } | 501 } |
| 510 | 502 |
| 511 } // namespace chromeos | 503 } // namespace chromeos |
| OLD | NEW |