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

Side by Side Diff: dbus/object_proxy.cc

Issue 9378039: dbus: add ObjectPath type (Closed) Base URL: http://git.chromium.org/git/chromium/src@master
Patch Set: add patch for cryptohome_client Created 8 years, 10 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
« no previous file with comments | « dbus/object_proxy.h ('k') | dbus/test_service.cc » ('j') | 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.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"
16 #include "dbus/object_proxy.h" 17 #include "dbus/object_proxy.h"
17 #include "dbus/scoped_dbus_error.h" 18 #include "dbus/scoped_dbus_error.h"
18 19
19 namespace { 20 namespace {
20 21
21 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown"; 22 const char kErrorServiceUnknown[] = "org.freedesktop.DBus.Error.ServiceUnknown";
22 23
23 // Used for success ratio histograms. 1 for success, 0 for failure. 24 // Used for success ratio histograms. 1 for success, 0 for failure.
24 const int kSuccessRatioHistogramMaxValue = 2; 25 const int kSuccessRatioHistogramMaxValue = 2;
25 26
26 // Gets the absolute signal name by concatenating the interface name and 27 // Gets the absolute signal name by concatenating the interface name and
27 // the signal name. Used for building keys for method_table_ in 28 // the signal name. Used for building keys for method_table_ in
28 // ObjectProxy. 29 // ObjectProxy.
29 std::string GetAbsoluteSignalName( 30 std::string GetAbsoluteSignalName(
30 const std::string& interface_name, 31 const std::string& interface_name,
31 const std::string& signal_name) { 32 const std::string& signal_name) {
32 return interface_name + "." + signal_name; 33 return interface_name + "." + signal_name;
33 } 34 }
34 35
35 // An empty function used for ObjectProxy::EmptyResponseCallback(). 36 // An empty function used for ObjectProxy::EmptyResponseCallback().
36 void EmptyResponseCallbackBody(dbus::Response* unused_response) { 37 void EmptyResponseCallbackBody(dbus::Response* unused_response) {
37 } 38 }
38 39
39 } // namespace 40 } // namespace
40 41
41 namespace dbus { 42 namespace dbus {
42 43
43 ObjectProxy::ObjectProxy(Bus* bus, 44 ObjectProxy::ObjectProxy(Bus* bus,
44 const std::string& service_name, 45 const std::string& service_name,
45 const std::string& object_path, 46 const ObjectPath& object_path,
46 int options) 47 int options)
47 : bus_(bus), 48 : bus_(bus),
48 service_name_(service_name), 49 service_name_(service_name),
49 object_path_(object_path), 50 object_path_(object_path),
50 filter_added_(false), 51 filter_added_(false),
51 ignore_service_unknown_errors_( 52 ignore_service_unknown_errors_(
52 options & IGNORE_SERVICE_UNKNOWN_ERRORS) { 53 options & IGNORE_SERVICE_UNKNOWN_ERRORS) {
53 } 54 }
54 55
55 ObjectProxy::~ObjectProxy() { 56 ObjectProxy::~ObjectProxy() {
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 void ObjectProxy::LogMethodCallFailure( 425 void ObjectProxy::LogMethodCallFailure(
425 const base::StringPiece& error_name, 426 const base::StringPiece& error_name,
426 const base::StringPiece& error_message) const { 427 const base::StringPiece& error_message) const {
427 if (ignore_service_unknown_errors_ && error_name == kErrorServiceUnknown) 428 if (ignore_service_unknown_errors_ && error_name == kErrorServiceUnknown)
428 return; 429 return;
429 LOG(ERROR) << "Failed to call method: " << error_name 430 LOG(ERROR) << "Failed to call method: " << error_name
430 << ": " << error_message; 431 << ": " << error_message;
431 } 432 }
432 433
433 } // namespace dbus 434 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/object_proxy.h ('k') | dbus/test_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698