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

Unified 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: Use pair, factor out error logging logic 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 side-by-side diff with in-line comments
Download patch
Index: dbus/object_proxy.h
diff --git a/dbus/object_proxy.h b/dbus/object_proxy.h
index ef453054915786accb66d82268a22506b6a69240..b4ab7ae1c41ee020e46ecbed661f886379604996 100644
--- a/dbus/object_proxy.h
+++ b/dbus/object_proxy.h
@@ -14,6 +14,7 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
+#include "base/string_piece.h"
#include "base/time.h"
namespace dbus {
@@ -30,11 +31,20 @@ class Signal;
// object is is alive when callbacks referencing |this| are called.
class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
public:
- // Client code should use Bus::GetObjectProxy() instead of this
- // constructor.
+ // Client code should use Bus::GetObjectProxy() or
+ // Bus::GetObjectProxyWithOptions() instead of this constructor.
ObjectProxy(Bus* bus,
const std::string& service_name,
- const std::string& object_path);
+ const std::string& object_path,
+ int options);
+
+ // Options to be OR-ed together when calling Bus::GetObjectProxyWithOptions().
+ // Set the IGNORE_SERVICE_UNKNOWN_ERRORS option to silence logging of
+ // org.freedesktop.DBus.Error.ServiceUnknown errors.
+ enum Options {
+ DEFAULT_OPTIONS = 0,
+ IGNORE_SERVICE_UNKNOWN_ERRORS = 1 << 0
+ };
// Special timeout constants.
//
@@ -180,6 +190,10 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
DBusMessage* raw_message,
void* user_data);
+ // Helper method for logging response errors appropriately.
+ void LogMethodCallFailure(const base::StringPiece& error_name,
+ const base::StringPiece& error_message) const;
+
scoped_refptr<Bus> bus_;
std::string service_name_;
std::string object_path_;
@@ -194,6 +208,8 @@ class ObjectProxy : public base::RefCountedThreadSafe<ObjectProxy> {
std::set<std::string> match_rules_;
+ const bool ignore_service_unknown_errors_;
+
DISALLOW_COPY_AND_ASSIGN(ObjectProxy);
};
« no previous file with comments | « dbus/mock_object_proxy.cc ('k') | dbus/object_proxy.cc » ('j') | dbus/object_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698