Bug 1261340: Don't refer to |ScopedFreePtrTraits| in |RawDBusConnection|, r=shuang
authorThomas Zimmermann <tdz@users.sourceforge.net>
Fri, 08 Apr 2016 10:07:28 +0200
changeset 349033 506fd0f2d9d320109e164af1839153b8cff09721
parent 349032 be02aaa8b2e8099047ac3c9dcb8ee06810cda5ee
child 349034 a60d4b9232b19fb0d9726bdc2376fe4924dee9fc
push id14991
push usermconley@mozilla.com
push dateFri, 08 Apr 2016 22:06:08 +0000
reviewersshuang
bugs1261340
milestone48.0a1
Bug 1261340: Don't refer to |ScopedFreePtrTraits| in |RawDBusConnection|, r=shuang The class template |ScopedFreePtrTrais| has been removed. This patch updates |RawDBusConnection| to not refer to it any longer. Instead, the provided helper method |empty| is implemented directly.
ipc/dbus/RawDBusConnection.cpp
ipc/dbus/RawDBusConnection.h
--- a/ipc/dbus/RawDBusConnection.cpp
+++ b/ipc/dbus/RawDBusConnection.cpp
@@ -1,15 +1,14 @@
 /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include <dbus/dbus.h>
 #include "base/message_loop.h"
 #include "nsThreadUtils.h"
 #include "RawDBusConnection.h"
 
 #ifdef CHROMIUM_LOG
 #undef CHROMIUM_LOG
 #endif
 
@@ -269,16 +268,21 @@ bool RawDBusConnection::Watch()
                                         DBusWatcher::RemoveWatchFunction,
                                         DBusWatcher::ToggleWatchFunction,
                                         this, nullptr);
   NS_ENSURE_TRUE(success == TRUE, false);
 
   return true;
 }
 
+DBusConnection* RawDBusConnection::ScopedDBusConnectionPtrTraits::empty()
+{
+  return nullptr;
+}
+
 void RawDBusConnection::ScopedDBusConnectionPtrTraits::release(DBusConnection* ptr)
 {
   if (ptr) {
     dbus_connection_close(ptr);
     dbus_connection_unref(ptr);
   }
 }
 
--- a/ipc/dbus/RawDBusConnection.h
+++ b/ipc/dbus/RawDBusConnection.h
@@ -2,30 +2,31 @@
 /* vim: set ts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ipc_dbus_gonk_rawdbusconnection_h__
 #define mozilla_ipc_dbus_gonk_rawdbusconnection_h__
 
+#include <dbus/dbus.h>
 #include "mozilla/Scoped.h"
 
-struct DBusConnection;
-struct DBusMessage;
-
 namespace mozilla {
 namespace ipc {
 
 typedef void (*DBusReplyCallback)(DBusMessage*, void*);
 
 class RawDBusConnection
 {
-  struct ScopedDBusConnectionPtrTraits : ScopedFreePtrTraits<DBusConnection>
+  struct ScopedDBusConnectionPtrTraits
   {
+    typedef DBusConnection* type;
+
+    static DBusConnection* empty();
     static void release(DBusConnection* ptr);
   };
 
 public:
   RawDBusConnection();
   virtual ~RawDBusConnection();
 
   nsresult EstablishDBusConnection();