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

Side by Side Diff: dbus/object_proxy.h

Issue 9373039: Allow dbus clients to silence logging when a service is unavailable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | Annotate | Revision Log
OLDNEW
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 #ifndef DBUS_OBJECT_PROXY_H_ 5 #ifndef DBUS_OBJECT_PROXY_H_
6 #define DBUS_OBJECT_PROXY_H_ 6 #define DBUS_OBJECT_PROXY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <dbus/dbus.h> 9 #include <dbus/dbus.h>
10 10
(...skipping 12 matching lines...) Expand all
23 class Response; 23 class Response;
24 class Signal; 24 class Signal;
25 25
26 // ObjectProxy is used to communicate with remote objects, mainly for 26 // ObjectProxy is used to communicate with remote objects, mainly for
27 // calling methods of these objects. 27 // calling methods of these objects.
28 // 28 //
29 // ObjectProxy is a ref counted object, to ensure that |this| of the 29 // ObjectProxy is a ref counted object, to ensure that |this| of the
30 // object is is alive when callbacks referencing |this| are called. 30 // object is is alive when callbacks referencing |this| are called.
31 class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> { 31 class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
32 public: 32 public:
33 // Clients should decide whether the service pointed to by this
34 // proxy must be available for proper operation. If not, they should
35 // pass IGNORE_SERVICE_UNKNOWN_ERRORS to silence logging of
36 // org.freedesktop.DBus.Error.ServiceUnknown errors.
37 enum ServiceUnknownBehavior {
38 LOG_SERVICE_UNKNOWN_ERRORS,
39 IGNORE_SERVICE_UNKNOWN_ERRORS
satorux1 2012/02/10 08:12:52 Let's make this more generic like // OR-ed option
satorux1 2012/02/10 08:15:13 Since it's inside ObjectProxy class, just 'Options
adamk 2012/02/10 17:57:16 Done.
adamk 2012/02/10 17:57:16 Done.
40 };
41
33 // Client code should use Bus::GetObjectProxy() instead of this 42 // Client code should use Bus::GetObjectProxy() instead of this
34 // constructor. 43 // constructor.
35 ObjectProxy(Bus* bus, 44 ObjectProxy(Bus* bus,
36 const std::string& service_name, 45 const std::string& service_name,
37 const std::string& object_path); 46 const std::string& object_path,
47 ServiceUnknownBehavior service_unknown_behavior);
satorux1 2012/02/10 08:12:52 And make it 'int'
adamk 2012/02/10 17:57:16 Done.
38 48
39 // Special timeout constants. 49 // Special timeout constants.
40 // 50 //
41 // The constants correspond to DBUS_TIMEOUT_USE_DEFAULT and 51 // The constants correspond to DBUS_TIMEOUT_USE_DEFAULT and
42 // DBUS_TIMEOUT_INFINITE. Here we use literal numbers instead of these 52 // DBUS_TIMEOUT_INFINITE. Here we use literal numbers instead of these
43 // macros as these aren't defined with D-Bus earlier than 1.4.12. 53 // macros as these aren't defined with D-Bus earlier than 1.4.12.
44 enum { 54 enum {
45 TIMEOUT_USE_DEFAULT = -1, 55 TIMEOUT_USE_DEFAULT = -1,
46 TIMEOUT_INFINITE = 0x7fffffff, 56 TIMEOUT_INFINITE = 0x7fffffff,
47 }; 57 };
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // True if the message filter was added. 197 // True if the message filter was added.
188 bool filter_added_; 198 bool filter_added_;
189 199
190 // The method table where keys are absolute signal names (i.e. interface 200 // The method table where keys are absolute signal names (i.e. interface
191 // name + signal name), and values are the corresponding callbacks. 201 // name + signal name), and values are the corresponding callbacks.
192 typedef std::map<std::string, SignalCallback> MethodTable; 202 typedef std::map<std::string, SignalCallback> MethodTable;
193 MethodTable method_table_; 203 MethodTable method_table_;
194 204
195 std::set<std::string> match_rules_; 205 std::set<std::string> match_rules_;
196 206
207 const bool log_unknown_service_errors_;
208
197 DISALLOW_COPY_AND_ASSIGN(ObjectProxy); 209 DISALLOW_COPY_AND_ASSIGN(ObjectProxy);
198 }; 210 };
199 211
200 } // namespace dbus 212 } // namespace dbus
201 213
202 #endif // DBUS_OBJECT_PROXY_H_ 214 #endif // DBUS_OBJECT_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698