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 330284 506fd0f2d9d320109e164af1839153b8cff09721
parent 330283 be02aaa8b2e8099047ac3c9dcb8ee06810cda5ee
child 330285 a60d4b9232b19fb0d9726bdc2376fe4924dee9fc
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersshuang
bugs1261340
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();