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

Unified Diff: chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.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 | « no previous file | dbus/bus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.cc
diff --git a/chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.cc b/chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.cc
index a0b523446c8498530673eda0a44ac3b7219d5866..505a6f425be0d1a491d9219cadd54ae5362d235d 100644
--- a/chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.cc
+++ b/chrome/browser/chromeos/dbus/bluetooth_agent_service_provider.cc
@@ -37,11 +37,12 @@ class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider {
: weak_ptr_factory_(this),
origin_thread_id_(base::PlatformThread::CurrentId()),
bus_(bus),
- delegate_(delegate) {
+ delegate_(delegate),
+ object_path_(object_path) {
DVLOG(1) << "Creating BluetoothAdapterClientImpl for "
<< object_path.value();
- exported_object_ = bus_->GetExportedObject(object_path);
+ exported_object_ = bus_->GetExportedObject(object_path_);
exported_object_->ExportMethod(
bluetooth_agent::kBluetoothAgentInterface,
@@ -119,6 +120,8 @@ class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider {
}
virtual ~BluetoothAgentServiceProviderImpl() {
+ // Unregister the object path so we can reuse with a new agent.
+ bus_->UnregisterExportedObject(object_path_);
}
private:
@@ -522,6 +525,10 @@ class BluetoothAgentServiceProviderImpl : public BluetoothAgentServiceProvider {
// owns this one, and must outlive it.
Delegate* delegate_;
+ // D-Bus object path of object we are exporting, kept so we can unregister
+ // again in our destructor.
+ dbus::ObjectPath object_path_;
+
// D-Bus object we are exporting, owned by this object.
scoped_refptr<dbus::ExportedObject> exported_object_;
« no previous file with comments | « no previous file | dbus/bus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698