Add some instrumentation for jank in URLRequest::Start.
[chromium-blink-merge.git] / chromeos / dbus / dbus_client_bundle.h
blob6db19534da2603fa50d907c4b1d686c142b82dda
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_
6 #define CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
11 #include "chromeos/chromeos_export.h"
13 namespace chromeos {
15 class AmplifierClient;
16 class ApManagerClient;
17 class AudioDspClient;
18 class BluetoothAdapterClient;
19 class BluetoothAgentManagerClient;
20 class BluetoothDeviceClient;
21 class BluetoothGattCharacteristicClient;
22 class BluetoothGattDescriptorClient;
23 class BluetoothGattManagerClient;
24 class BluetoothGattServiceClient;
25 class BluetoothInputClient;
26 class BluetoothLEAdvertisingManagerClient;
27 class BluetoothMediaClient;
28 class BluetoothMediaTransportClient;
29 class BluetoothProfileManagerClient;
30 class CrasAudioClient;
31 class CrosDisksClient;
32 class CryptohomeClient;
33 class DebugDaemonClient;
34 class EasyUnlockClient;
35 class GsmSMSClient;
36 class ImageBurnerClient;
37 class IntrospectableClient;
38 class LeadershipDaemonManagerClient;
39 class LorgnetteManagerClient;
40 class MetronomeClient;
41 class ModemMessagingClient;
42 class NfcAdapterClient;
43 class NfcDeviceClient;
44 class NfcManagerClient;
45 class NfcRecordClient;
46 class NfcTagClient;
47 class PeerDaemonManagerClient;
48 class PermissionBrokerClient;
49 class PowerManagerClient;
50 class PrivetDaemonManagerClient;
51 class SMSClient;
52 class SessionManagerClient;
53 class ShillDeviceClient;
54 class ShillIPConfigClient;
55 class ShillManagerClient;
56 class ShillProfileClient;
57 class ShillServiceClient;
58 class ShillThirdPartyVpnDriverClient;
59 class SystemClockClient;
60 class UpdateEngineClient;
62 // The bundle of all D-Bus clients used in DBusThreadManager. The bundle
63 // is used to delete them at once in the right order before shutting down the
64 // system bus. See also the comment in the destructor of DBusThreadManager.
65 class CHROMEOS_EXPORT DBusClientBundle {
66 public:
67 typedef int DBusClientTypeMask;
69 // TODO(zelidrag): We might want to collapse few more of these subsystems if
70 // their dbus interfaced correspond to the same daemon.
71 enum DBusClientType {
72 NO_CLIENT = 0,
73 BLUETOOTH = 1 << 0,
74 CRAS = 1 << 1,
75 CROS_DISKS = 1 << 2,
76 CRYPTOHOME = 1 << 3,
77 DEBUG_DAEMON = 1 << 4,
78 EASY_UNLOCK = 1 << 5,
79 LORGNETTE_MANAGER = 1 << 6,
80 SHILL = 1 << 7,
81 GSM_SMS = 1 << 8,
82 IMAGE_BURNER = 1 << 9,
83 INTROSPECTABLE = 1 << 10,
84 MODEM_MESSAGING = 1 << 11,
85 NFC = 1 << 12,
86 PERMISSION_BROKER = 1 << 13,
87 POWER_MANAGER = 1 << 14,
88 SESSION_MANAGER = 1 << 15,
89 SMS = 1 << 16,
90 SYSTEM_CLOCK = 1 << 17,
91 UPDATE_ENGINE = 1 << 18,
92 PEER_DAEMON = 1 << 19,
93 LEADERSHIP_DAEMON = 1 << 20,
94 METRONOME = 1 << 21,
95 AP_MANAGER = 1 << 22,
96 PRIVET_DAEMON = 1 << 23,
97 AMPLIFIER = 1 << 24,
98 AUDIO_DSP = 1 << 25,
101 explicit DBusClientBundle(DBusClientTypeMask unstub_client_mask);
102 ~DBusClientBundle();
104 // Returns true if |client| is stubbed.
105 bool IsUsingStub(DBusClientType client);
107 // Returns true if any real DBusClient is used.
108 bool IsUsingAnyRealClient();
110 // Initialize proper runtime environment for its dbus clients.
111 void SetupDefaultEnvironment();
113 // Parses command line param values for dbus subsystem that should be
114 // un-stubbed.
115 static DBusClientTypeMask ParseUnstubList(const std::string& unstub_list);
117 AmplifierClient* amplifier_client() { return amplifier_client_.get(); }
119 ApManagerClient* ap_manager_client() { return ap_manager_client_.get(); }
121 AudioDspClient* audio_dsp_client() { return audio_dsp_client_.get(); }
123 BluetoothAdapterClient* bluetooth_adapter_client() {
124 return bluetooth_adapter_client_.get();
127 BluetoothLEAdvertisingManagerClient*
128 bluetooth_le_advertising_manager_client() {
129 return bluetooth_le_advertising_manager_client_.get();
132 BluetoothAgentManagerClient* bluetooth_agent_manager_client() {
133 return bluetooth_agent_manager_client_.get();
136 BluetoothDeviceClient* bluetooth_device_client() {
137 return bluetooth_device_client_.get();
140 BluetoothGattCharacteristicClient* bluetooth_gatt_characteristic_client() {
141 return bluetooth_gatt_characteristic_client_.get();
144 BluetoothGattDescriptorClient* bluetooth_gatt_descriptor_client() {
145 return bluetooth_gatt_descriptor_client_.get();
148 BluetoothGattManagerClient* bluetooth_gatt_manager_client() {
149 return bluetooth_gatt_manager_client_.get();
152 BluetoothGattServiceClient* bluetooth_gatt_service_client() {
153 return bluetooth_gatt_service_client_.get();
156 BluetoothInputClient* bluetooth_input_client() {
157 return bluetooth_input_client_.get();
160 BluetoothMediaClient* bluetooth_media_client() {
161 return bluetooth_media_client_.get();
164 BluetoothMediaTransportClient* bluetooth_media_transport_client() {
165 return bluetooth_media_transport_client_.get();
168 BluetoothProfileManagerClient* bluetooth_profile_manager_client() {
169 return bluetooth_profile_manager_client_.get();
172 CrasAudioClient* cras_audio_client() {
173 return cras_audio_client_.get();
176 CrosDisksClient* cros_disks_client() {
177 return cros_disks_client_.get();
180 CryptohomeClient* cryptohome_client() {
181 return cryptohome_client_.get();
184 DebugDaemonClient* debug_daemon_client() {
185 return debug_daemon_client_.get();
188 EasyUnlockClient* easy_unlock_client() {
189 return easy_unlock_client_.get();
192 LeadershipDaemonManagerClient* leadership_daemon_manager_client() {
193 return leadership_daemon_manager_client_.get();
196 LorgnetteManagerClient* lorgnette_manager_client() {
197 return lorgnette_manager_client_.get();
200 MetronomeClient* metronome_client() { return metronome_client_.get(); }
202 ShillDeviceClient* shill_device_client() {
203 return shill_device_client_.get();
206 ShillIPConfigClient* shill_ipconfig_client() {
207 return shill_ipconfig_client_.get();
210 ShillManagerClient* shill_manager_client() {
211 return shill_manager_client_.get();
214 ShillServiceClient* shill_service_client() {
215 return shill_service_client_.get();
218 ShillProfileClient* shill_profile_client() {
219 return shill_profile_client_.get();
222 ShillThirdPartyVpnDriverClient* shill_third_party_vpn_driver_client() {
223 return shill_third_party_vpn_driver_client_.get();
226 GsmSMSClient* gsm_sms_client() {
227 return gsm_sms_client_.get();
230 ImageBurnerClient* image_burner_client() {
231 return image_burner_client_.get();
234 IntrospectableClient* introspectable_client() {
235 return introspectable_client_.get();
238 ModemMessagingClient* modem_messaging_client() {
239 return modem_messaging_client_.get();
242 NfcManagerClient* nfc_manager_client() {
243 return nfc_manager_client_.get();
246 NfcAdapterClient* nfc_adapter_client() {
247 return nfc_adapter_client_.get();
250 NfcDeviceClient* nfc_device_client() {
251 return nfc_device_client_.get();
254 NfcTagClient* nfc_tag_client() {
255 return nfc_tag_client_.get();
258 NfcRecordClient* nfc_record_client() {
259 return nfc_record_client_.get();
262 PeerDaemonManagerClient* peer_daemon_manager_client() {
263 return peer_daemon_manager_client_.get();
266 PermissionBrokerClient* permission_broker_client() {
267 return permission_broker_client_.get();
270 PrivetDaemonManagerClient* privet_daemon_manager_client() {
271 return privet_daemon_manager_client_.get();
274 SystemClockClient* system_clock_client() {
275 return system_clock_client_.get();
278 PowerManagerClient* power_manager_client() {
279 return power_manager_client_.get();
282 SessionManagerClient* session_manager_client() {
283 return session_manager_client_.get();
286 SMSClient* sms_client() {
287 return sms_client_.get();
290 UpdateEngineClient* update_engine_client() {
291 return update_engine_client_.get();
294 private:
295 friend class DBusThreadManagerSetter;
297 // Bitmask that defines which dbus clients are not stubbed out. Bitmap flags
298 // are defined within DBusClientType enum.
299 DBusClientTypeMask unstub_client_mask_;
301 scoped_ptr<AmplifierClient> amplifier_client_;
302 scoped_ptr<ApManagerClient> ap_manager_client_;
303 scoped_ptr<AudioDspClient> audio_dsp_client_;
304 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
305 scoped_ptr<BluetoothLEAdvertisingManagerClient>
306 bluetooth_le_advertising_manager_client_;
307 scoped_ptr<BluetoothAgentManagerClient> bluetooth_agent_manager_client_;
308 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
309 scoped_ptr<BluetoothGattCharacteristicClient>
310 bluetooth_gatt_characteristic_client_;
311 scoped_ptr<BluetoothGattDescriptorClient> bluetooth_gatt_descriptor_client_;
312 scoped_ptr<BluetoothGattManagerClient> bluetooth_gatt_manager_client_;
313 scoped_ptr<BluetoothGattServiceClient> bluetooth_gatt_service_client_;
314 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
315 scoped_ptr<BluetoothMediaClient> bluetooth_media_client_;
316 scoped_ptr<BluetoothMediaTransportClient> bluetooth_media_transport_client_;
317 scoped_ptr<BluetoothProfileManagerClient> bluetooth_profile_manager_client_;
318 scoped_ptr<CrasAudioClient> cras_audio_client_;
319 scoped_ptr<CrosDisksClient> cros_disks_client_;
320 scoped_ptr<CryptohomeClient> cryptohome_client_;
321 scoped_ptr<DebugDaemonClient> debug_daemon_client_;
322 scoped_ptr<EasyUnlockClient> easy_unlock_client_;
323 scoped_ptr<LeadershipDaemonManagerClient> leadership_daemon_manager_client_;
324 scoped_ptr<LorgnetteManagerClient> lorgnette_manager_client_;
325 scoped_ptr<MetronomeClient> metronome_client_;
326 scoped_ptr<PeerDaemonManagerClient> peer_daemon_manager_client_;
327 scoped_ptr<PrivetDaemonManagerClient> privet_daemon_manager_client_;
328 scoped_ptr<ShillDeviceClient> shill_device_client_;
329 scoped_ptr<ShillIPConfigClient> shill_ipconfig_client_;
330 scoped_ptr<ShillManagerClient> shill_manager_client_;
331 scoped_ptr<ShillServiceClient> shill_service_client_;
332 scoped_ptr<ShillProfileClient> shill_profile_client_;
333 scoped_ptr<ShillThirdPartyVpnDriverClient>
334 shill_third_party_vpn_driver_client_;
335 scoped_ptr<GsmSMSClient> gsm_sms_client_;
336 scoped_ptr<ImageBurnerClient> image_burner_client_;
337 scoped_ptr<IntrospectableClient> introspectable_client_;
338 scoped_ptr<ModemMessagingClient> modem_messaging_client_;
339 // The declaration order for NFC client objects is important. See
340 // DBusThreadManager::InitializeClients for the dependencies.
341 scoped_ptr<NfcManagerClient> nfc_manager_client_;
342 scoped_ptr<NfcAdapterClient> nfc_adapter_client_;
343 scoped_ptr<NfcDeviceClient> nfc_device_client_;
344 scoped_ptr<NfcTagClient> nfc_tag_client_;
345 scoped_ptr<NfcRecordClient> nfc_record_client_;
346 scoped_ptr<PermissionBrokerClient> permission_broker_client_;
347 scoped_ptr<SystemClockClient> system_clock_client_;
348 scoped_ptr<PowerManagerClient> power_manager_client_;
349 scoped_ptr<SessionManagerClient> session_manager_client_;
350 scoped_ptr<SMSClient> sms_client_;
351 scoped_ptr<UpdateEngineClient> update_engine_client_;
353 DISALLOW_COPY_AND_ASSIGN(DBusClientBundle);
356 } // namespace chromeos
358 #endif // CHROMEOS_DBUS_DBUS_CLIENT_BUNDLE_H_