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

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: update doc from nit 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..91ba252152362ecab354e52773e6805ef46e9fc1 100644
--- a/dbus/bus.cc
+++ b/dbus/bus.cc
@@ -250,6 +250,35 @@ 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 in
+ // TryRegisterObjectPath(), and the message loop proxy we post to is a
+ // MessageLoopProxy which inherits from SequencedTaskRunner, there is a
+ // guarantee that this will 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