OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // TODO(satorux): | 5 // TODO(satorux): |
6 // - Handle "disconnected" signal. | 6 // - Handle "disconnected" signal. |
7 | 7 |
8 #include "dbus/bus.h" | 8 #include "dbus/bus.h" |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 return iter->second; | 228 return iter->second; |
229 } | 229 } |
230 | 230 |
231 scoped_refptr<ObjectProxy> object_proxy = | 231 scoped_refptr<ObjectProxy> object_proxy = |
232 new ObjectProxy(this, service_name, object_path, options); | 232 new ObjectProxy(this, service_name, object_path, options); |
233 object_proxy_table_[key] = object_proxy; | 233 object_proxy_table_[key] = object_proxy; |
234 | 234 |
235 return object_proxy.get(); | 235 return object_proxy.get(); |
236 } | 236 } |
237 | 237 |
238 void Bus::RemoveObjectProxy(const std::string& service_name, | |
239 const ObjectPath& object_path) { | |
240 RemoveObjectProxyWithOptions(service_name, object_path, | |
241 ObjectProxy::DEFAULT_OPTIONS); | |
242 } | |
243 | |
244 void Bus::RemoveObjectProxyWithOptions(const std::string& service_name, | |
245 const dbus::ObjectPath& object_path, | |
246 int options) { | |
247 AssertOnOriginThread(); | |
248 | |
249 // Check if we have the requested object proxy. | |
250 const ObjectProxyTable::key_type key(service_name + object_path.value(), | |
251 options); | |
252 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); | |
253 if (iter != object_proxy_table_.end()) { | |
254 // Detach and erase | |
255 iter->second.get()->Detach(); | |
satorux1
2013/01/18 17:32:40
You cannot all Detach() here, as Detach() should b
| |
256 object_proxy_table_.erase(iter); | |
257 } | |
258 } | |
259 | |
238 ExportedObject* Bus::GetExportedObject(const ObjectPath& object_path) { | 260 ExportedObject* Bus::GetExportedObject(const ObjectPath& object_path) { |
239 AssertOnOriginThread(); | 261 AssertOnOriginThread(); |
240 | 262 |
241 // Check if we already have the requested exported object. | 263 // Check if we already have the requested exported object. |
242 ExportedObjectTable::iterator iter = exported_object_table_.find(object_path); | 264 ExportedObjectTable::iterator iter = exported_object_table_.find(object_path); |
243 if (iter != exported_object_table_.end()) { | 265 if (iter != exported_object_table_.end()) { |
244 return iter->second; | 266 return iter->second; |
245 } | 267 } |
246 | 268 |
247 scoped_refptr<ExportedObject> exported_object = | 269 scoped_refptr<ExportedObject> exported_object = |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
843 } | 865 } |
844 | 866 |
845 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, | 867 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, |
846 DBusDispatchStatus status, | 868 DBusDispatchStatus status, |
847 void* data) { | 869 void* data) { |
848 Bus* self = static_cast<Bus*>(data); | 870 Bus* self = static_cast<Bus*>(data); |
849 self->OnDispatchStatusChanged(connection, status); | 871 self->OnDispatchStatusChanged(connection, status); |
850 } | 872 } |
851 | 873 |
852 } // namespace dbus | 874 } // namespace dbus |
OLD | NEW |