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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 AssertOnOriginThread(); | 211 AssertOnOriginThread(); |
212 | 212 |
213 // Check if we already have the requested object proxy. | 213 // Check if we already have the requested object proxy. |
214 const std::string key = service_name + object_path; | 214 const std::string key = service_name + object_path; |
215 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); | 215 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); |
216 if (iter != object_proxy_table_.end()) { | 216 if (iter != object_proxy_table_.end()) { |
217 return iter->second; | 217 return iter->second; |
218 } | 218 } |
219 | 219 |
220 scoped_refptr<ObjectProxy> object_proxy = | 220 scoped_refptr<ObjectProxy> object_proxy = |
221 new ObjectProxy(this, service_name, object_path); | 221 new ObjectProxy(this, service_name, object_path, |
| 222 ObjectProxy::LOG_SERVICE_UNKNOWN_ERRORS); |
222 object_proxy_table_[key] = object_proxy; | 223 object_proxy_table_[key] = object_proxy; |
223 | 224 |
224 return object_proxy.get(); | 225 return object_proxy.get(); |
| 226 } |
| 227 |
| 228 ObjectProxy* Bus::GetObjectProxyIgnoreUnknownService( |
| 229 const std::string& service_name, const std::string& object_path) { |
| 230 AssertOnOriginThread(); |
| 231 |
| 232 // Check if we already have the requested object proxy. |
| 233 const std::string key = service_name + object_path + "IGNORE_SERVICE_UNKNOWN"; |
| 234 ObjectProxyTable::iterator iter = object_proxy_table_.find(key); |
| 235 if (iter != object_proxy_table_.end()) { |
| 236 return iter->second; |
| 237 } |
| 238 |
| 239 scoped_refptr<ObjectProxy> object_proxy = |
| 240 new ObjectProxy(this, service_name, object_path, |
| 241 ObjectProxy::IGNORE_SERVICE_UNKNOWN_ERRORS); |
| 242 object_proxy_table_[key] = object_proxy; |
| 243 |
| 244 return object_proxy.get(); |
225 } | 245 } |
226 | 246 |
227 ExportedObject* Bus::GetExportedObject(const std::string& service_name, | 247 ExportedObject* Bus::GetExportedObject(const std::string& service_name, |
228 const std::string& object_path) { | 248 const std::string& object_path) { |
229 AssertOnOriginThread(); | 249 AssertOnOriginThread(); |
230 | 250 |
231 // Check if we already have the requested exported object. | 251 // Check if we already have the requested exported object. |
232 const std::string key = service_name + object_path; | 252 const std::string key = service_name + object_path; |
233 ExportedObjectTable::iterator iter = exported_object_table_.find(key); | 253 ExportedObjectTable::iterator iter = exported_object_table_.find(key); |
234 if (iter != exported_object_table_.end()) { | 254 if (iter != exported_object_table_.end()) { |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } | 768 } |
749 | 769 |
750 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, | 770 void Bus::OnDispatchStatusChangedThunk(DBusConnection* connection, |
751 DBusDispatchStatus status, | 771 DBusDispatchStatus status, |
752 void* data) { | 772 void* data) { |
753 Bus* self = static_cast<Bus*>(data); | 773 Bus* self = static_cast<Bus*>(data); |
754 return self->OnDispatchStatusChanged(connection, status); | 774 return self->OnDispatchStatusChanged(connection, status); |
755 } | 775 } |
756 | 776 |
757 } // namespace dbus | 777 } // namespace dbus |
OLD | NEW |