Chromium Code Reviews| 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(); |