Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1068)

Side by Side Diff: dbus/object_proxy.cc

Issue 455533002: Reduce DBus ObjectUnknown ERROR to WARNING (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Correctly log at severity Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dbus/object_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/strings/string_piece.h" 11 #include "base/strings/string_piece.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/task_runner_util.h" 13 #include "base/task_runner_util.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "base/threading/thread_restrictions.h" 15 #include "base/threading/thread_restrictions.h"
16 #include "dbus/dbus_statistics.h" 16 #include "dbus/dbus_statistics.h"
17 #include "dbus/message.h" 17 #include "dbus/message.h"
18 #include "dbus/object_path.h" 18 #include "dbus/object_path.h"
19 #include "dbus/object_proxy.h" 19 #include "dbus/object_proxy.h"
20 #include "dbus/scoped_dbus_error.h" 20 #include "dbus/scoped_dbus_error.h"
21 21
22 namespace dbus { 22 namespace dbus {
23 23
24 namespace { 24 namespace {
25 25
26 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown"; 26 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown";
27 const char kErrorObjectUnknown[] = "org.freedesktop.DBus.Error.UnknownObject";
27 28
28 // Used for success ratio histograms. 1 for success, 0 for failure. 29 // Used for success ratio histograms. 1 for success, 0 for failure.
29 const int kSuccessRatioHistogramMaxValue = 2; 30 const int kSuccessRatioHistogramMaxValue = 2;
30 31
31 // The path of D-Bus Object sending NameOwnerChanged signal. 32 // The path of D-Bus Object sending NameOwnerChanged signal.
32 const char kDBusSystemObjectPath[] = "/org/freedesktop/DBus"; 33 const char kDBusSystemObjectPath[] = "/org/freedesktop/DBus";
33 34
34 // The D-Bus Object interface. 35 // The D-Bus Object interface.
35 const char kDBusSystemObjectInterface[] = "org.freedesktop.DBus"; 36 const char kDBusSystemObjectInterface[] = "org.freedesktop.DBus";
36 37
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 void* user_data) { 555 void* user_data) {
555 ObjectProxy* self = reinterpret_cast<ObjectProxy*>(user_data); 556 ObjectProxy* self = reinterpret_cast<ObjectProxy*>(user_data);
556 return self->HandleMessage(connection, raw_message); 557 return self->HandleMessage(connection, raw_message);
557 } 558 }
558 559
559 void ObjectProxy::LogMethodCallFailure( 560 void ObjectProxy::LogMethodCallFailure(
560 const base::StringPiece& interface_name, 561 const base::StringPiece& interface_name,
561 const base::StringPiece& method_name, 562 const base::StringPiece& method_name,
562 const base::StringPiece& error_name, 563 const base::StringPiece& error_name,
563 const base::StringPiece& error_message) const { 564 const base::StringPiece& error_message) const {
564 if (ignore_service_unknown_errors_ && error_name == kErrorServiceUnknown) 565 if (ignore_service_unknown_errors_ &&
566 (error_name == kErrorServiceUnknown || error_name == kErrorObjectUnknown))
565 return; 567 return;
566 LOG(ERROR) << "Failed to call method: " 568 logging::LogSeverity severity = logging::LOG_ERROR;
567 << interface_name << "." << method_name 569 // "UnknownObject" indicates that an object or service is no longer available,
568 << ": object_path= " << object_path_.value() 570 // e.g. a Shill network service has gone out of range. Treat these as warnings
569 << ": " << error_name << ": " << error_message; 571 // not errors.
572 if (error_name == kErrorObjectUnknown)
573 severity = logging::LOG_WARNING;
574 std::ostringstream msg;
575 msg << "Failed to call method: " << interface_name << "." << method_name
576 << ": object_path= " << object_path_.value()
577 << ": " << error_name << ": " << error_message;
578 logging::LogAtLevel(severity, msg.str());
570 } 579 }
571 580
572 void ObjectProxy::OnCallMethodError(const std::string& interface_name, 581 void ObjectProxy::OnCallMethodError(const std::string& interface_name,
573 const std::string& method_name, 582 const std::string& method_name,
574 ResponseCallback response_callback, 583 ResponseCallback response_callback,
575 ErrorResponse* error_response) { 584 ErrorResponse* error_response) {
576 if (error_response) { 585 if (error_response) {
577 // Error message may contain the error message as string. 586 // Error message may contain the error message as string.
578 MessageReader reader(error_response); 587 MessageReader reader(error_response);
579 std::string error_message; 588 std::string error_message;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 bool service_is_available) { 703 bool service_is_available) {
695 bus_->AssertOnOriginThread(); 704 bus_->AssertOnOriginThread();
696 705
697 std::vector<WaitForServiceToBeAvailableCallback> callbacks; 706 std::vector<WaitForServiceToBeAvailableCallback> callbacks;
698 callbacks.swap(wait_for_service_to_be_available_callbacks_); 707 callbacks.swap(wait_for_service_to_be_available_callbacks_);
699 for (size_t i = 0; i < callbacks.size(); ++i) 708 for (size_t i = 0; i < callbacks.size(); ++i)
700 callbacks[i].Run(service_is_available); 709 callbacks[i].Run(service_is_available);
701 } 710 }
702 711
703 } // namespace dbus 712 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/object_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698