OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_DBUS_H_ | 5 #ifndef CHROMEOS_DBUS_H_ |
6 #define CHROMEOS_DBUS_H_ | 6 #define CHROMEOS_DBUS_H_ |
7 | 7 |
8 #include <dbus/dbus-glib.h> | 8 #include <dbus/dbus-glib.h> |
9 #include <glib-object.h> | 9 #include <glib-object.h> |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 ~BusConnection() { | 40 ~BusConnection() { |
41 ::dbus_g_connection_unref(object_); | 41 ::dbus_g_connection_unref(object_); |
42 } | 42 } |
43 | 43 |
44 BusConnection& operator=(BusConnection x) { | 44 BusConnection& operator=(BusConnection x) { |
45 swap(*this, x); | 45 swap(*this, x); |
46 return *this; | 46 return *this; |
47 } | 47 } |
48 | 48 |
| 49 const value_type& g_connection() const { |
| 50 DCHECK(object_) << "referencing an empty connection"; |
| 51 return object_; |
| 52 } |
| 53 |
49 private: | 54 private: |
50 friend void swap(BusConnection& x, BusConnection& y); | 55 friend void swap(BusConnection& x, BusConnection& y); |
51 | 56 |
52 friend class Proxy; | 57 friend class Proxy; |
53 friend BusConnection GetSystemBusConnection(); | 58 friend BusConnection GetSystemBusConnection(); |
54 friend BusConnection GetPrivateBusConnection(const char* address); | 59 friend BusConnection GetPrivateBusConnection(const char* address); |
55 | 60 |
56 // Constructor takes ownership | 61 // Constructor takes ownership |
57 explicit BusConnection(::DBusGConnection* x) | 62 explicit BusConnection(::DBusGConnection* x) |
58 : object_(x) { | 63 : object_(x) { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 BusConnection GetSystemBusConnection(); | 322 BusConnection GetSystemBusConnection(); |
318 | 323 |
319 // \brief Returns a private connection to a bus at |address|. | 324 // \brief Returns a private connection to a bus at |address|. |
320 | 325 |
321 BusConnection GetPrivateBusConnection(const char* address); | 326 BusConnection GetPrivateBusConnection(const char* address); |
322 | 327 |
323 } // namespace dbus | 328 } // namespace dbus |
324 } // namespace chromeos | 329 } // namespace chromeos |
325 | 330 |
326 #endif // CHROMEOS_DBUS_H_ | 331 #endif // CHROMEOS_DBUS_H_ |
OLD | NEW |