| 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 #include "dbus/bus.h" | 5 #include "dbus/bus.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 const ObjectPath& object_path, | 258 const ObjectPath& object_path, |
| 259 int options, | 259 int options, |
| 260 const base::Closure& callback) { | 260 const base::Closure& callback) { |
| 261 AssertOnOriginThread(); | 261 AssertOnOriginThread(); |
| 262 | 262 |
| 263 // Check if we have the requested object proxy. | 263 // Check if we have the requested object proxy. |
| 264 const ObjectProxyTable::key_type key(service_name + object_path.value(), | 264 const ObjectProxyTable::key_type key(service_name + object_path.value(), |
| 265 options); | 265 options); |
| 266 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); | 266 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); |
| 267 if (iter != object_proxy_table_.end()) { | 267 if (iter != object_proxy_table_.end()) { |
| 268 scoped_refptr<ObjectProxy> object_proxy = iter->second; |
| 269 object_proxy_table_.erase(iter); |
| 268 // Object is present. Remove it now and Detach in the DBus thread. | 270 // Object is present. Remove it now and Detach in the DBus thread. |
| 269 GetDBusTaskRunner()->PostTask( | 271 GetDBusTaskRunner()->PostTask( |
| 270 FROM_HERE, | 272 FROM_HERE, |
| 271 base::Bind(&Bus::RemoveObjectProxyInternal, | 273 base::Bind(&Bus::RemoveObjectProxyInternal, |
| 272 this, iter->second, callback)); | 274 this, object_proxy, callback)); |
| 273 | |
| 274 object_proxy_table_.erase(iter); | |
| 275 return true; | 275 return true; |
| 276 } | 276 } |
| 277 return false; | 277 return false; |
| 278 } | 278 } |
| 279 | 279 |
| 280 void Bus::RemoveObjectProxyInternal(scoped_refptr<ObjectProxy> object_proxy, | 280 void Bus::RemoveObjectProxyInternal(scoped_refptr<ObjectProxy> object_proxy, |
| 281 const base::Closure& callback) { | 281 const base::Closure& callback) { |
| 282 AssertOnDBusThread(); | 282 AssertOnDBusThread(); |
| 283 | 283 |
| 284 object_proxy.get()->Detach(); | 284 object_proxy.get()->Detach(); |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 kNameOwnerChangedSignal)) { | 1189 kNameOwnerChangedSignal)) { |
| 1190 Bus* self = static_cast<Bus*>(data); | 1190 Bus* self = static_cast<Bus*>(data); |
| 1191 self->OnServiceOwnerChanged(message); | 1191 self->OnServiceOwnerChanged(message); |
| 1192 } | 1192 } |
| 1193 // Always return unhandled to let others, e.g. ObjectProxies, handle the same | 1193 // Always return unhandled to let others, e.g. ObjectProxies, handle the same |
| 1194 // signal. | 1194 // signal. |
| 1195 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; | 1195 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 } // namespace dbus | 1198 } // namespace dbus |
| OLD | NEW |