OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 DCHECK(registered_object_paths_.empty()); | 201 DCHECK(registered_object_paths_.empty()); |
202 DCHECK_EQ(0, num_pending_watches_); | 202 DCHECK_EQ(0, num_pending_watches_); |
203 // TODO(satorux): This check fails occasionally in browser_tests for tests | 203 // TODO(satorux): This check fails occasionally in browser_tests for tests |
204 // that run very quickly. Perhaps something does not have time to clean up. | 204 // that run very quickly. Perhaps something does not have time to clean up. |
205 // Despite the check failing, the tests seem to run fine. crosbug.com/23416 | 205 // Despite the check failing, the tests seem to run fine. crosbug.com/23416 |
206 // DCHECK_EQ(0, num_pending_timeouts_); | 206 // DCHECK_EQ(0, num_pending_timeouts_); |
207 } | 207 } |
208 | 208 |
209 ObjectProxy* Bus::GetObjectProxy(const std::string& service_name, | 209 ObjectProxy* Bus::GetObjectProxy(const std::string& service_name, |
210 const std::string& object_path) { | 210 const std::string& object_path) { |
| 211 return GetObjectProxyWithOptions(service_name, object_path, |
| 212 ObjectProxy::DEFAULT_OPTIONS); |
| 213 } |
| 214 |
| 215 ObjectProxy* Bus::GetObjectProxyWithOptions(const std::string& service_name, |
| 216 const std::string& object_path, |
| 217 int options) { |
211 AssertOnOriginThread(); | 218 AssertOnOriginThread(); |
212 | 219 |
213 // Check if we already have the requested object proxy. | 220 // Check if we already have the requested object proxy. |
214 const std::string key = service_name + object_path; | 221 const ObjectProxyTable::key_type key(service_name + object_path, options); |
215 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); | 222 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); |
216 if (iter != object_proxy_table_.end()) { | 223 if (iter != object_proxy_table_.end()) { |
217 return iter->second; | 224 return iter->second; |
218 } | 225 } |
219 | 226 |
220 scoped_refptr<ObjectProxy> object_proxy = | 227 scoped_refptr<ObjectProxy> object_proxy = |
221 new ObjectProxy(this, service_name, object_path); | 228 new ObjectProxy(this, service_name, object_path, options); |
222 object_proxy_table_[key] = object_proxy; | 229 object_proxy_table_[key] = object_proxy; |
223 | 230 |
224 return object_proxy.get(); | 231 return object_proxy.get(); |
225 } | 232 } |
226 | 233 |
227 ExportedObject* Bus::GetExportedObject(const std::string& service_name, | 234 ExportedObject* Bus::GetExportedObject(const std::string& service_name, |
228 const std::string& object_path) { | 235 const std::string& object_path) { |
229 AssertOnOriginThread(); | 236 AssertOnOriginThread(); |
230 | 237 |
231 // Check if we already have the requested exported object. | 238 // Check if we already have the requested exported object. |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } | 755 } |
749 | 756 |
750 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, | 757 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, |
751 DBusDispatchStatus status, | 758 DBusDispatchStatus status, |
752 void* data) { | 759 void* data) { |
753 Bus* self = static_cast<Bus*>(data); | 760 Bus* self = static_cast<Bus*>(data); |
754 return self->OnDispatchStatusChanged(connection, status); | 761 return self->OnDispatchStatusChanged(connection, status); |
755 } | 762 } |
756 | 763 |
757 } // namespace dbus | 764 } // namespace dbus |
OLD | NEW |