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 #include "chromeos/dbus/dbus.h" | 5 #include "chromeos/dbus/dbus.h" |
6 | 6 |
7 #include <dbus/dbus.h> | 7 #include <dbus/dbus.h> |
8 #include <dbus/dbus-glib-bindings.h> | 8 #include <dbus/dbus-glib-bindings.h> |
9 #include <dbus/dbus-glib-lowlevel.h> | 9 #include <dbus/dbus-glib-lowlevel.h> |
10 #include <base/logging.h> | 10 #include <base/logging.h> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // signals nor method calls. | 58 // signals nor method calls. |
59 GetSystemBusConnection(); | 59 GetSystemBusConnection(); |
60 | 60 |
61 ::DBusError error; | 61 ::DBusError error; |
62 ::dbus_error_init(&error); | 62 ::dbus_error_init(&error); |
63 | 63 |
64 ::DBusGConnection* result = NULL; | 64 ::DBusGConnection* result = NULL; |
65 ::DBusConnection* raw_connection | 65 ::DBusConnection* raw_connection |
66 = ::dbus_connection_open_private(address, &error); | 66 = ::dbus_connection_open_private(address, &error); |
67 if (!raw_connection) { | 67 if (!raw_connection) { |
68 // TODO(yusukes): We should return an error rather than just abort(). | 68 LOG(WARNING) << "dbus_connection_open_private failed: " << address; |
69 LOG(FATAL) << "dbus_connection_open_private failed"; | 69 return BusConnection(NULL); |
70 } | 70 } |
71 | 71 |
72 if (!::dbus_bus_register(raw_connection, &error)) { | 72 if (!::dbus_bus_register(raw_connection, &error)) { |
73 LOG(ERROR) << "dbus_bus_register failed"; | 73 LOG(ERROR) << "dbus_bus_register failed: " |
| 74 << (error.message ? error.message : "Unknown Error."); |
74 ::dbus_error_free(&error); | 75 ::dbus_error_free(&error); |
| 76 // TODO(yusukes): We don't call dbus_connection_close() nor g_object_unref() |
| 77 // here for now since these calls might interfare with IBusBus connections |
| 78 // in libcros and Chrome. See the comment in ~InputMethodStatusConnection() |
| 79 // function in platform/cros/chromeos_input_method.cc for details. |
| 80 return BusConnection(NULL); |
75 } | 81 } |
76 | 82 |
77 ::dbus_connection_setup_with_g_main( | 83 ::dbus_connection_setup_with_g_main( |
78 raw_connection, NULL /* default context */); | 84 raw_connection, NULL /* default context */); |
79 | 85 |
80 // A reference count of |raw_connection| is transferred to |result|. You don't | 86 // A reference count of |raw_connection| is transferred to |result|. You don't |
81 // have to (and should not) unref the |raw_connection|. | 87 // have to (and should not) unref the |raw_connection|. |
82 result = ::dbus_connection_get_g_connection(raw_connection); | 88 result = ::dbus_connection_get_g_connection(raw_connection); |
83 CHECK(result); | 89 CHECK(result); |
84 | 90 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 dbus_g_connection_register_g_object(connection.g_connection(), | 219 dbus_g_connection_register_g_object(connection.g_connection(), |
214 service_path, | 220 service_path, |
215 object); | 221 object); |
216 return true; | 222 return true; |
217 } | 223 } |
218 | 224 |
219 | 225 |
220 | 226 |
221 } // namespace dbus | 227 } // namespace dbus |
222 } // namespace chromeos | 228 } // namespace chromeos |
OLD | NEW |