diff options
author | Daniel Erat <derat@google.com> | 2015-07-15 16:43:47 -0600 |
---|---|---|
committer | Daniel Erat <derat@google.com> | 2015-07-15 16:44:39 -0600 |
commit | ae6a045d2239408e25198ad17e2413bdde105788 (patch) | |
tree | 19273b29d22200acaa6303987ae6040937c12428 /dbus/scoped_dbus_error.h | |
parent | 2195afc7463609b2f01978090cf1482c6eae0bbd (diff) | |
download | libchrome-ae6a045d2239408e25198ad17e2413bdde105788.tar.gz |
Add upstream dbus/ code as of Chromium r334380.
Copy the unchanged source from
https://chromium.googlesource.com/chromium/src/dbus/ as of
r334380 (really r334285 a.k.a. d04f83ef in the dbus/
subtree).
Bug: 22317122
Change-Id: I598920914a737fe12e2f8199d6826f113991dc5b
Diffstat (limited to 'dbus/scoped_dbus_error.h')
-rw-r--r-- | dbus/scoped_dbus_error.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/dbus/scoped_dbus_error.h b/dbus/scoped_dbus_error.h new file mode 100644 index 0000000000..1484dbb81b --- /dev/null +++ b/dbus/scoped_dbus_error.h @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef DBUS_SCOPED_DBUS_ERROR_H_ +#define DBUS_SCOPED_DBUS_ERROR_H_ + +#include <dbus/dbus.h> + +#include "dbus/dbus_export.h" + +namespace dbus { + +// Utility class to ensure that DBusError is freed. +class CHROME_DBUS_EXPORT ScopedDBusError { + public: + // Do not inline methods that call dbus_error_xxx() functions. + // See http://crbug.com/416628 + ScopedDBusError(); + ~ScopedDBusError(); + + DBusError* get() { return &error_; } + bool is_set() const; + const char* name() { return error_.name; } + const char* message() { return error_.message; } + + private: + DBusError error_; +}; + +} // namespace dbus + +#endif // DBUS_SCOPED_DBUS_ERROR_H_ |