LCOV - code coverage report
Current view: top level - ipc/dbus - DBusConnectionDelete.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 8 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
       2             : /* vim: set ts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_ipc_DBusConnectionDelete_h
       8             : #define mozilla_ipc_DBusConnectionDelete_h
       9             : 
      10             : #include <dbus/dbus.h>
      11             : #include "mozilla/UniquePtr.h"
      12             : 
      13             : namespace mozilla {
      14             : 
      15             : /*
      16             :  * |DBusConnectionDelete| is a deleter for managing instances
      17             :  * of |DBusConnection| in |UniquePtr|. Upon destruction, it
      18             :  * will close an open connection before unref'ing the data
      19             :  * structure.
      20             :  *
      21             :  * Do not use |UniquePtr| with shared DBus connections. For
      22             :  * shared connections, use |RefPtr|.
      23             :  */
      24             : class DBusConnectionDelete
      25             : {
      26             : public:
      27           0 :   constexpr DBusConnectionDelete()
      28           0 :   { }
      29             : 
      30           0 :   void operator()(DBusConnection* aConnection) const
      31             :   {
      32           0 :     MOZ_ASSERT(aConnection);
      33           0 :     if (dbus_connection_get_is_connected(aConnection)) {
      34           0 :       dbus_connection_close(aConnection);
      35             :     }
      36           0 :     dbus_connection_unref(aConnection);
      37           0 :   }
      38             : };
      39             : 
      40             : } // namespace mozilla
      41             : 
      42             : #endif // mozilla_ipc_DBusConnectionDelete_h

Generated by: LCOV version 1.13