12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "update_engine/dbus_connection.h"
- #include <base/time/time.h>
- namespace chromeos_update_engine {
- namespace {
- const int kDBusSystemMaxWaitSeconds = 2 * 60;
- DBusConnection* dbus_connection_singleton = nullptr;
- }
- DBusConnection::DBusConnection() {
-
-
- bus_ = dbus_connection_.ConnectWithTimeout(
- base::TimeDelta::FromSeconds(kDBusSystemMaxWaitSeconds));
- if (!bus_) {
-
-
- LOG(FATAL) << "Failed to initialize DBus, aborting.";
- }
- CHECK(bus_->SetUpAsyncOperations());
- }
- const scoped_refptr<dbus::Bus>& DBusConnection::GetDBus() {
- CHECK(bus_);
- return bus_;
- }
- DBusConnection* DBusConnection::Get() {
- if (!dbus_connection_singleton)
- dbus_connection_singleton = new DBusConnection();
- return dbus_connection_singleton;
- }
- }
|