| 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/object_proxy.h" | 5 #include "dbus/object_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 558 } |
| 559 | 559 |
| 560 void ObjectProxy::LogMethodCallFailure( | 560 void ObjectProxy::LogMethodCallFailure( |
| 561 const base::StringPiece& interface_name, | 561 const base::StringPiece& interface_name, |
| 562 const base::StringPiece& method_name, | 562 const base::StringPiece& method_name, |
| 563 const base::StringPiece& error_name, | 563 const base::StringPiece& error_name, |
| 564 const base::StringPiece& error_message) const { | 564 const base::StringPiece& error_message) const { |
| 565 if (ignore_service_unknown_errors_ && | 565 if (ignore_service_unknown_errors_ && |
| 566 (error_name == kErrorServiceUnknown || error_name == kErrorObjectUnknown)) | 566 (error_name == kErrorServiceUnknown || error_name == kErrorObjectUnknown)) |
| 567 return; | 567 return; |
| 568 logging::LogSeverity severity = logging::LOG_ERROR; | 568 |
| 569 std::ostringstream msg; |
| 570 msg << "Failed to call method: " << interface_name << "." << method_name |
| 571 << ": object_path= " << object_path_.value() |
| 572 << ": " << error_name << ": " << error_message; |
| 573 |
| 569 // "UnknownObject" indicates that an object or service is no longer available, | 574 // "UnknownObject" indicates that an object or service is no longer available, |
| 570 // e.g. a Shill network service has gone out of range. Treat these as warnings | 575 // e.g. a Shill network service has gone out of range. Treat these as warnings |
| 571 // not errors. | 576 // not errors. |
| 572 if (error_name == kErrorObjectUnknown) | 577 if (error_name == kErrorObjectUnknown) |
| 573 severity = logging::LOG_WARNING; | 578 LOG(WARNING) << msg.str(); |
| 574 std::ostringstream msg; | 579 else |
| 575 msg << "Failed to call method: " << interface_name << "." << method_name | 580 LOG(ERROR) << msg.str(); |
| 576 << ": object_path= " << object_path_.value() | |
| 577 << ": " << error_name << ": " << error_message; | |
| 578 logging::LogAtLevel(severity, msg.str()); | |
| 579 } | 581 } |
| 580 | 582 |
| 581 void ObjectProxy::OnCallMethodError(const std::string& interface_name, | 583 void ObjectProxy::OnCallMethodError(const std::string& interface_name, |
| 582 const std::string& method_name, | 584 const std::string& method_name, |
| 583 ResponseCallback response_callback, | 585 ResponseCallback response_callback, |
| 584 ErrorResponse* error_response) { | 586 ErrorResponse* error_response) { |
| 585 if (error_response) { | 587 if (error_response) { |
| 586 // Error message may contain the error message as string. | 588 // Error message may contain the error message as string. |
| 587 MessageReader reader(error_response); | 589 MessageReader reader(error_response); |
| 588 std::string error_message; | 590 std::string error_message; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 bool service_is_available) { | 705 bool service_is_available) { |
| 704 bus_->AssertOnOriginThread(); | 706 bus_->AssertOnOriginThread(); |
| 705 | 707 |
| 706 std::vector<WaitForServiceToBeAvailableCallback> callbacks; | 708 std::vector<WaitForServiceToBeAvailableCallback> callbacks; |
| 707 callbacks.swap(wait_for_service_to_be_available_callbacks_); | 709 callbacks.swap(wait_for_service_to_be_available_callbacks_); |
| 708 for (size_t i = 0; i < callbacks.size(); ++i) | 710 for (size_t i = 0; i < callbacks.size(); ++i) |
| 709 callbacks[i].Run(service_is_available); | 711 callbacks[i].Run(service_is_available); |
| 710 } | 712 } |
| 711 | 713 |
| 712 } // namespace dbus | 714 } // namespace dbus |
| OLD | NEW |