tree: 663e74cff7dcf09edccd38a63bbbf3ff13bc148c [path history] [tgz]
  1. anomaly_detector/
  2. arc/
  3. attestation/
  4. audio/
  5. cdm_factory_daemon/
  6. cec_service/
  7. chromebox_for_meetings/
  8. chunneld/
  9. cicerone/
  10. common/
  11. concierge/
  12. config/
  13. constants/
  14. cros_disks/
  15. cryptohome/
  16. debug_daemon/
  17. dlcservice/
  18. dlp/
  19. easy_unlock/
  20. federated/
  21. fusebox/
  22. fwupd/
  23. gnubby/
  24. hammerd/
  25. hermes/
  26. hps/
  27. image_burner/
  28. image_loader/
  29. init/
  30. ip_peripheral/
  31. lorgnette_manager/
  32. machine_learning/
  33. media_analytics/
  34. missive/
  35. oobe_config/
  36. permission_broker/
  37. power/
  38. resourced/
  39. rmad/
  40. runtime_probe/
  41. seneschal/
  42. services/
  43. session_manager/
  44. shill/
  45. smbprovider/
  46. system_clock/
  47. system_proxy/
  48. tpm_manager/
  49. u2f/
  50. update_engine/
  51. usb/
  52. userdataauth/
  53. util/
  54. virtual_file_provider/
  55. vm_plugin_dispatcher/
  56. blocking_method_caller_unittest.cc
  57. BUILD.gn
  58. COMMON_METADATA
  59. dbus_clients_browser.cc
  60. dbus_clients_browser.h
  61. dbus_thread_manager.cc
  62. dbus_thread_manager.h
  63. dbus_thread_manager_unittest.cc
  64. DEPS
  65. DIR_METADATA
  66. native_timer_unittest.cc
  67. OWNERS
  68. pipe_reader_unittest.cc
  69. README.md
chromeos/dbus/README.md

src/chromeos/dbus

This directory contains client libraries for communication with Chrome OS system service daemons over D-Bus.

For more information, see Chrome OS D-Bus Usage in Chrome.

DBusThreadManager

The DBusThreadManager class was originally created to both own the D-Bus base::Thread, the system dbus::Bus instance, and all of the D-Bus clients.

With the significantly increased number of clients, this model no longer makes sense.

New clients should not be added to DBusThreadManager but instead should follow the pattern described below. DBusThreadManager will eventually be deprecated.

D-Bus Client Best Practices

An example of a relatively simple client using existing patterns can be found in src/chromeos/ash/components/dbus/kerberos.

  • Create a subdirectory under src/chromeos/dbus for new clients or use an existing directory. Do not add new clients to this directory.

  • D-Bus clients are explicitly initialized and shut down. They provide a static getter for the single global instance. In Ash Chrome, initialization occurs in ash_dbus_helper.cc. In Lacros Chrome, initialization occurs in lacros_dbus_helper.cc.

  • Be careful when providing access to multiple processes (e.g. Ash Chrome and Lacros Chrome). Not all of the underlying daemons support multiple clients.

  • For new clients, if test methods are required, create a TestInterface in the base class with a virtual GetTestInterface() method and implement it only in the fake (return null in the real implementation). See src/chromeos/ash/components/dbus/kerberos for an example.

    (Many existing clients provide additional test functionality in the fake implementation, however this complicates tests and the fake implementation).

  • These clients do not have any dependency on FeatureList, and care should be taken regarding initialization order if such dependencies are added (see BluezDBusManager for an example of such client).

Shill clients

The DBusThreadManager::GetShill*Client() methods have been left intact for now. However, the clients are no longer owned by DBusThreadManager so that they can be initialized independently.

New code should prefer Shill*Client::Get() over the DBusThreadManager accessors.

Older clients that have been removed:

  • Amplifier (amplifier_client.cc)
  • Audio DSP (audio_dsp_client.cc)
  • Introspection (introspectable_client.cc)
  • NFC (nfc_manager_client.cc)
  • peerd (peer_daemon_manager_client.cc)
  • privetd (privet_daemon_manager_client.cc)
  • Wi-Fi AP manager (ap_manager_client.cc)