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

Side by Side Diff: dbus/scoped_dbus_error.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 unified diff | Download patch | Annotate | Revision Log
« dbus/object_proxy.cc ('K') | « dbus/object_proxy.cc ('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) 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_SCOPED_DBUS_ERROR_H_ 5 #ifndef DBUS_SCOPED_DBUS_ERROR_H_
6 #define DBUS_SCOPED_DBUS_ERROR_H_ 6 #define DBUS_SCOPED_DBUS_ERROR_H_
7 #pragma once 7 #pragma once
8 8
9 #include <dbus/dbus.h> 9 #include <dbus/dbus.h>
10 10
11 namespace dbus { 11 namespace dbus {
12 12
13 // Utility class to ensure that DBusError is freed. 13 // Utility class to ensure that DBusError is freed.
14 class ScopedDBusError { 14 class ScopedDBusError {
15 public: 15 public:
16 ScopedDBusError() { 16 ScopedDBusError() {
17 dbus_error_init(&error_); 17 dbus_error_init(&error_);
18 } 18 }
19 19
20 ~ScopedDBusError() { 20 ~ScopedDBusError() {
21 dbus_error_free(&error_); 21 dbus_error_free(&error_);
22 } 22 }
23 23
24 DBusError* get() { return &error_; } 24 DBusError* get() { return &error_; }
25 bool is_set() { return dbus_error_is_set(&error_); } 25 bool is_set() { return dbus_error_is_set(&error_); }
26 const char* name() { return error_.name; }
26 const char* message() { return error_.message; } 27 const char* message() { return error_.message; }
27 28
28 private: 29 private:
29 DBusError error_; 30 DBusError error_;
30 }; 31 };
31 32
32 } // namespace dbus 33 } // namespace dbus
33 34
34 #endif // DBUS_SCOPED_DBUS_ERROR_H_ 35 #endif // DBUS_SCOPED_DBUS_ERROR_H_
OLDNEW
« dbus/object_proxy.cc ('K') | « dbus/object_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698