Home | History | Annotate | Download | only in glib
      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 
      9 namespace brillo {
     10 namespace dbus {
     11 
     12 bool 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 
     20 bool 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 
     30 bool AbstractDbusService::Shutdown() {
     31   ::g_main_loop_quit(main_loop());
     32   return true;
     33 }
     34 
     35 }  // namespace dbus
     36 }  // namespace brillo
     37