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

Unified Diff: chromeos/dbus/dbus_client_bundle.h

Issue 2319783002: mash: Allow a subset of D-Bus clients to be created in DBusThreadManager (Closed)
Patch Set: WIP, add DBusThreadManagerAsh and DBusThreadManagerChrome Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/cros_disks_client.cc ('k') | chromeos/dbus/dbus_client_bundle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/dbus_client_bundle.h
diff --git a/chromeos/dbus/dbus_client_bundle.h b/chromeos/dbus/dbus_client_bundle.h
index 176e3ac8351ef4db538f097baba20f1d55f0cdce..529a966e0173847d033dfdd1aa8c43d5d47449af 100644
--- a/chromeos/dbus/dbus_client_bundle.h
+++ b/chromeos/dbus/dbus_client_bundle.h
@@ -36,15 +36,15 @@ class ShillThirdPartyVpnDriverClient;
class SystemClockClient;
class UpdateEngineClient;
+// Declared outside of DBusClientBundle to make identifiers shorter in outside
+// classes.
+using DBusClientTypeMask = int;
+
// The bundle of all D-Bus clients used in DBusThreadManager. The bundle
// is used to delete them at once in the right order before shutting down the
// system bus. See also the comment in the destructor of DBusThreadManager.
class CHROMEOS_EXPORT DBusClientBundle {
public:
- typedef int DBusClientTypeMask;
-
- // TODO(zelidrag): We might want to collapse few more of these subsystems if
- // their dbus interfaced correspond to the same daemon.
enum DBusClientType {
NO_CLIENT = 0,
BLUETOOTH = 1 << 0,
@@ -65,13 +65,23 @@ class CHROMEOS_EXPORT DBusClientBundle {
SYSTEM_CLOCK = 1 << 15,
UPDATE_ENGINE = 1 << 16,
ARC_OBB_MOUNTER = 1 << 17,
+ ALL_CLIENTS = ~NO_CLIENT,
};
- explicit DBusClientBundle(DBusClientTypeMask unstub_client_mask);
+ // Creates real implementations for |real_client_mask| and fakes for
+ // |fake_client_mask|. The masks must be mutually exclusive. Fakes are used
+ // when running on Linux desktop and in tests. If a client does not appear in
+ // either mask then no implementation will be created and the getters below
+ // will return null.
+ DBusClientBundle(DBusClientTypeMask real_client_mask,
+ DBusClientTypeMask fake_client_mask);
~DBusClientBundle();
- // Returns true if |client| is stubbed.
- bool IsUsingStub(DBusClientType client);
+ // Returns true if |client| is faked.
+ bool IsUsingFake(DBusClientType client) const;
+
+ // Returns true if |client| has the real client implementation.
+ bool IsUsingReal(DBusClientType client) const;
// Returns true if any real DBusClient is used.
bool IsUsingAnyRealClient();
@@ -79,8 +89,8 @@ class CHROMEOS_EXPORT DBusClientBundle {
// Initialize proper runtime environment for its dbus clients.
void SetupDefaultEnvironment();
- // Parses command line param values for dbus subsystem that should be
- // un-stubbed.
+ // Parses command line param values for dbus subsystems that should be forced
+ // to use real implementations.
static DBusClientTypeMask ParseUnstubList(const std::string& unstub_list);
ArcObbMounterClient* arc_obb_mounter_client() {
@@ -174,10 +184,14 @@ class CHROMEOS_EXPORT DBusClientBundle {
private:
friend class DBusThreadManagerSetter;
- // Bitmask that defines which dbus clients are not stubbed out. Bitmap flags
- // are defined within DBusClientType enum.
- DBusClientTypeMask unstub_client_mask_;
+ // Bitmask for clients with real implementations. See DBusClientType.
+ const DBusClientTypeMask real_client_mask_;
+
+ // Bitmask for clients with fake implementations. See DBusClientType.
+ const DBusClientTypeMask fake_client_mask_;
+ // May be null if the current process does not use the client (e.g. in the
+ // ash process on mustash).
std::unique_ptr<ArcObbMounterClient> arc_obb_mounter_client_;
std::unique_ptr<CrasAudioClient> cras_audio_client_;
std::unique_ptr<CrosDisksClient> cros_disks_client_;
« no previous file with comments | « chromeos/dbus/cros_disks_client.cc ('k') | chromeos/dbus/dbus_client_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698