Index: dbus/bus.cc |
diff --git a/dbus/bus.cc b/dbus/bus.cc |
index 9d4a43638495a361f54d466e5890424285e2b4e6..727f47dbb218b1cef8ad5c543efb05d9b9970905 100644 |
--- a/dbus/bus.cc |
+++ b/dbus/bus.cc |
@@ -12,6 +12,7 @@ |
#include "base/message_loop.h" |
#include "base/message_loop_proxy.h" |
#include "base/stl_util.h" |
+#include "base/synchronization/waitable_event.h" |
#include "base/threading/thread.h" |
#include "base/threading/thread_restrictions.h" |
#include "base/time.h" |
@@ -250,6 +251,34 @@ ExportedObject* Bus::GetExportedObject(const ObjectPath& object_path) { |
return exported_object.get(); |
} |
+void Bus::UnregisterExportedObject(const ObjectPath& object_path) { |
+ AssertOnOriginThread(); |
+ |
+ base::WaitableEvent completion(false, false); |
+ |
+ PostTaskToDBusThread(FROM_HERE, base::Bind( |
+ &Bus::UnregisterExportedObjectInternal, |
+ this, object_path, &completion)); |
+ |
+ completion.Wait(); |
+} |
+ |
+void Bus::UnregisterExportedObjectInternal(const ObjectPath& object_path, |
+ base::WaitableEvent* completion) { |
+ DCHECK(completion); |
+ AssertOnDBusThread(); |
+ |
+ // Make sure the requested object exists. |
+ ExportedObjectTable::iterator iter = exported_object_table_.find(object_path); |
+ if (iter == exported_object_table_.end()) |
+ return; |
+ |
+ iter->second->Unregister(); |
+ exported_object_table_.erase(iter); |
+ |
+ completion->Signal(); |
+} |
+ |
bool Bus::Connect() { |
// dbus_bus_get_private() and dbus_bus_get() are blocking calls. |
AssertOnDBusThread(); |