1// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <base/logging.h>
6
7#include "brillo/glib/abstract_dbus_service.h"
8
9namespace brillo {
10namespace dbus {
11
12bool AbstractDbusService::Register(const brillo::dbus::BusConnection& conn) {
13  return RegisterExclusiveService(conn,
14                                  service_interface(),
15                                  service_name(),
16                                  service_path(),
17                                  service_object());
18}
19
20bool AbstractDbusService::Run() {
21  if (!main_loop()) {
22    LOG(ERROR) << "No run loop. Call Initialize before use.";
23    return false;
24  }
25  ::g_main_loop_run(main_loop());
26  DLOG(INFO) << "Run() completed";
27  return true;
28}
29
30bool AbstractDbusService::Shutdown() {
31  ::g_main_loop_quit(main_loop());
32  return true;
33}
34
35}  // namespace dbus
36}  // namespace brillo
37