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

Unified Diff: dbus/bus.cc

Issue 9691025: dbus: allow unregistering of exported objects (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use the sequenced task runner properties rather than a waitable event Created 8 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/bus_unittest.cc » ('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 9d4a43638495a361f54d466e5890424285e2b4e6..471aea1b4d4b32236b9c99be3f3cc8e69ae34dd3 100644
--- a/dbus/bus.cc
+++ b/dbus/bus.cc
@@ -250,6 +250,34 @@ ExportedObject* Bus::GetExportedObject(const ObjectPath& object_path) {
return exported_object.get();
}
+void Bus::UnregisterExportedObject(const ObjectPath& object_path) {
+ AssertOnOriginThread();
+
+ // Remove the registered object from the table first, to allow a new
+ // GetExportedObject() call to return a new object, rather than this one.
+ ExportedObjectTable::iterator iter = exported_object_table_.find(object_path);
+ if (iter == exported_object_table_.end())
+ return;
+
+ scoped_refptr<ExportedObject> exported_object = iter->second;
+ exported_object_table_.erase(iter);
+
+ // Post the task to perform the final unregistration to the D-Bus thread.
+ // Since the registration also happens on the D-Bus thread, and the message
+ // loop proxy is a SequencedTaskRunner, there is a guarantee that this will
satorux1 2012/03/13 20:15:33 I was confused at first. might want to add somethi
keybuk 2012/03/13 20:25:01 Done.
+ // happen before any future registration call.
+ PostTaskToDBusThread(FROM_HERE, base::Bind(
+ &Bus::UnregisterExportedObjectInternal,
+ this, exported_object));
+}
+
+void Bus::UnregisterExportedObjectInternal(
+ scoped_refptr<dbus::ExportedObject> exported_object) {
+ AssertOnDBusThread();
+
+ exported_object->Unregister();
+}
+
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/bus_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698