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

Unified Diff: dbus/bus.cc

Issue 12491014: Support D-Bus Object Manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Insufficient entrails in my offering Created 7 years, 9 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 | « dbus/bus.h ('k') | dbus/dbus.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/bus.cc
diff --git a/dbus/bus.cc b/dbus/bus.cc
index e895e584b63b5980687389f00f875143c092fa17..cfc833db3c1d23447c488c13e4f901be4f4ddabe 100644
--- a/dbus/bus.cc
+++ b/dbus/bus.cc
@@ -13,6 +13,8 @@
#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "dbus/exported_object.h"
+#include "dbus/object_manager.h"
+#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
#include "dbus/scoped_dbus_error.h"
@@ -322,6 +324,44 @@ void Bus::UnregisterExportedObjectInternal(
exported_object->Unregister();
}
+ObjectManager* Bus::GetObjectManager(const std::string& service_name,
+ const ObjectPath& object_path) {
+ AssertOnOriginThread();
+
+ // Check if we already have the requested object manager.
+ const ObjectManagerTable::key_type key(service_name + object_path.value());
+ ObjectManagerTable::iterator iter = object_manager_table_.find(key);
+ if (iter != object_manager_table_.end()) {
+ return iter->second;
+ }
+
+ scoped_refptr<ObjectManager> object_manager =
+ new ObjectManager(this, service_name, object_path);
+ object_manager_table_[key] = object_manager;
+
+ return object_manager.get();
+}
+
+void Bus::RemoveObjectManager(const std::string& service_name,
+ const ObjectPath& object_path) {
+ AssertOnOriginThread();
+
+ const ObjectManagerTable::key_type key(service_name + object_path.value());
+ ObjectManagerTable::iterator iter = object_manager_table_.find(key);
+ if (iter == object_manager_table_.end())
+ return;
+
+ scoped_refptr<ObjectManager> object_manager = iter->second;
+ object_manager_table_.erase(iter);
+}
+
+void Bus::GetManagedObjects() {
+ for (ObjectManagerTable::iterator iter = object_manager_table_.begin();
+ iter != object_manager_table_.end(); ++iter) {
+ iter->second->GetManagedObjects();
+ }
+}
+
bool Bus::Connect() {
// dbus_bus_get_private() and dbus_bus_get() are blocking calls.
AssertOnDBusThread();
« no previous file with comments | « dbus/bus.h ('k') | dbus/dbus.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698