| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/string_piece.h" | 11 #include "base/string_piece.h" |
| 12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "dbus/message.h" | 15 #include "dbus/message.h" |
| 16 #include "dbus/object_path.h" | |
| 17 #include "dbus/object_proxy.h" | 16 #include "dbus/object_proxy.h" |
| 18 #include "dbus/scoped_dbus_error.h" | 17 #include "dbus/scoped_dbus_error.h" |
| 19 | 18 |
| 20 namespace { | 19 namespace { |
| 21 | 20 |
| 22 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown"; | 21 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown"; |
| 23 | 22 |
| 24 // Used for success ratio histograms. 1 for success, 0 for failure. | 23 // Used for success ratio histograms. 1 for success, 0 for failure. |
| 25 const int kSuccessRatioHistogramMaxValue = 2; | 24 const int kSuccessRatioHistogramMaxValue = 2; |
| 26 | 25 |
| 27 // Gets the absolute signal name by concatenating the interface name and | 26 // Gets the absolute signal name by concatenating the interface name and |
| 28 // the signal name. Used for building keys for method_table_ in | 27 // the signal name. Used for building keys for method_table_ in |
| 29 // ObjectProxy. | 28 // ObjectProxy. |
| 30 std::string GetAbsoluteSignalName( | 29 std::string GetAbsoluteSignalName( |
| 31 const std::string& interface_name, | 30 const std::string& interface_name, |
| 32 const std::string& signal_name) { | 31 const std::string& signal_name) { |
| 33 return interface_name + "." + signal_name; | 32 return interface_name + "." + signal_name; |
| 34 } | 33 } |
| 35 | 34 |
| 36 // An empty function used for ObjectProxy::EmptyResponseCallback(). | 35 // An empty function used for ObjectProxy::EmptyResponseCallback(). |
| 37 void EmptyResponseCallbackBody(dbus::Response* unused_response) { | 36 void EmptyResponseCallbackBody(dbus::Response* unused_response) { |
| 38 } | 37 } |
| 39 | 38 |
| 40 } // namespace | 39 } // namespace |
| 41 | 40 |
| 42 namespace dbus { | 41 namespace dbus { |
| 43 | 42 |
| 44 ObjectProxy::ObjectProxy(Bus* bus, | 43 ObjectProxy::ObjectProxy(Bus* bus, |
| 45 const std::string& service_name, | 44 const std::string& service_name, |
| 46 const ObjectPath& object_path, | 45 const std::string& object_path, |
| 47 int options) | 46 int options) |
| 48 : bus_(bus), | 47 : bus_(bus), |
| 49 service_name_(service_name), | 48 service_name_(service_name), |
| 50 object_path_(object_path), | 49 object_path_(object_path), |
| 51 filter_added_(false), | 50 filter_added_(false), |
| 52 ignore_service_unknown_errors_( | 51 ignore_service_unknown_errors_( |
| 53 options & IGNORE_SERVICE_UNKNOWN_ERRORS) { | 52 options & IGNORE_SERVICE_UNKNOWN_ERRORS) { |
| 54 } | 53 } |
| 55 | 54 |
| 56 ObjectProxy::~ObjectProxy() { | 55 ObjectProxy::~ObjectProxy() { |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 void ObjectProxy::LogMethodCallFailure( | 424 void ObjectProxy::LogMethodCallFailure( |
| 426 const base::StringPiece& error_name, | 425 const base::StringPiece& error_name, |
| 427 const base::StringPiece& error_message) const { | 426 const base::StringPiece& error_message) const { |
| 428 if (ignore_service_unknown_errors_ && error_name == kErrorServiceUnknown) | 427 if (ignore_service_unknown_errors_ && error_name == kErrorServiceUnknown) |
| 429 return; | 428 return; |
| 430 LOG(ERROR) << "Failed to call method: " << error_name | 429 LOG(ERROR) << "Failed to call method: " << error_name |
| 431 << ": " << error_message; | 430 << ": " << error_message; |
| 432 } | 431 } |
| 433 | 432 |
| 434 } // namespace dbus | 433 } // namespace dbus |
| OLD | NEW |