From 66fa98429a5ac8b9e37b673bdf7b73f6c47b4725 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Thu, 30 Jul 2015 10:34:51 +0200 Subject: [PATCH] Bug 1187249: Cleanup BluetoothInterfaceHelpers.{cpp,h}, r=shuang This patch moves the last conversion function to Bluetooth's daemon backend and removes the files BluetoothInterfaceHelpers.{cpp,h}. --- dom/bluetooth/BluetoothInterfaceHelpers.cpp | 28 ------------------- dom/bluetooth/BluetoothInterfaceHelpers.h | 23 --------------- .../bluedroid/BluetoothDaemonA2dpInterface.h | 1 - .../bluedroid/BluetoothDaemonAvrcpInterface.h | 1 - .../bluedroid/BluetoothDaemonGattInterface.h | 1 - .../BluetoothDaemonHandsfreeInterface.h | 1 - .../bluedroid/BluetoothDaemonHelpers.cpp | 13 +++++++++ .../bluedroid/BluetoothDaemonHelpers.h | 3 ++ .../bluedroid/BluetoothDaemonInterface.cpp | 1 - .../BluetoothDaemonSocketInterface.h | 1 - dom/bluetooth/moz.build | 1 - 11 files changed, 16 insertions(+), 58 deletions(-) delete mode 100644 dom/bluetooth/BluetoothInterfaceHelpers.cpp delete mode 100644 dom/bluetooth/BluetoothInterfaceHelpers.h diff --git a/dom/bluetooth/BluetoothInterfaceHelpers.cpp b/dom/bluetooth/BluetoothInterfaceHelpers.cpp deleted file mode 100644 index 03e0c6d3c9a0..000000000000 --- a/dom/bluetooth/BluetoothInterfaceHelpers.cpp +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=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 "BluetoothInterfaceHelpers.h" - -BEGIN_BLUETOOTH_NAMESPACE - -// -// Conversion -// - -nsresult -Convert(nsresult aIn, BluetoothStatus& aOut) -{ - if (NS_SUCCEEDED(aIn)) { - aOut = STATUS_SUCCESS; - } else if (aIn == NS_ERROR_OUT_OF_MEMORY) { - aOut = STATUS_NOMEM; - } else { - aOut = STATUS_FAIL; - } - return NS_OK; -} - -END_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/BluetoothInterfaceHelpers.h b/dom/bluetooth/BluetoothInterfaceHelpers.h deleted file mode 100644 index 0c32f60667b4..000000000000 --- a/dom/bluetooth/BluetoothInterfaceHelpers.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=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_dom_bluetooth_bluetoothinterfacehelpers_h -#define mozilla_dom_bluetooth_bluetoothinterfacehelpers_h - -#include "BluetoothCommon.h" - -BEGIN_BLUETOOTH_NAMESPACE - -// -// Conversion -// - -nsresult -Convert(nsresult aIn, BluetoothStatus& aOut); - -END_BLUETOOTH_NAMESPACE - -#endif diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h index cfc5a2d191df..2c42981a2770 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonA2dpInterface.h @@ -9,7 +9,6 @@ #include "BluetoothDaemonHelpers.h" #include "BluetoothInterface.h" -#include "BluetoothInterfaceHelpers.h" #include "mozilla/ipc/DaemonRunnables.h" BEGIN_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h index 5b4c3a452f47..c906503256e9 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonAvrcpInterface.h @@ -9,7 +9,6 @@ #include "BluetoothDaemonHelpers.h" #include "BluetoothInterface.h" -#include "BluetoothInterfaceHelpers.h" #include "mozilla/ipc/DaemonRunnables.h" BEGIN_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h index 44184ffc4d55..0998032e13cb 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonGattInterface.h @@ -9,7 +9,6 @@ #include "BluetoothDaemonHelpers.h" #include "BluetoothInterface.h" -#include "BluetoothInterfaceHelpers.h" #include "mozilla/ipc/DaemonRunnables.h" BEGIN_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h index 7c4f6244c543..9c62314db16e 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.h @@ -9,7 +9,6 @@ #include "BluetoothDaemonHelpers.h" #include "BluetoothInterface.h" -#include "BluetoothInterfaceHelpers.h" #include "mozilla/ipc/DaemonRunnables.h" BEGIN_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp index 93f6afac2566..0403e3529361 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.cpp @@ -524,6 +524,19 @@ Convert(const nsAString& aIn, BluetoothServiceName& aOut) return NS_OK; } +nsresult +Convert(nsresult aIn, BluetoothStatus& aOut) +{ + if (NS_SUCCEEDED(aIn)) { + aOut = STATUS_SUCCESS; + } else if (aIn == NS_ERROR_OUT_OF_MEMORY) { + aOut = STATUS_NOMEM; + } else { + aOut = STATUS_FAIL; + } + return NS_OK; +} + nsresult Convert(BluetoothAclState aIn, bool& aOut) { diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h index 84c59f3a5712..32de4709bf70 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonHelpers.h @@ -288,6 +288,9 @@ Convert(BluetoothGattAuthReq aIn, int32_t& aOut); nsresult Convert(BluetoothGattWriteType aIn, int32_t& aOut); +nsresult +Convert(nsresult aIn, BluetoothStatus& aOut); + // // Packing // diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index e01ed1a88753..3297b1aa97e9 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -16,7 +16,6 @@ #include "BluetoothDaemonHelpers.h" #include "BluetoothDaemonSetupInterface.h" #include "BluetoothDaemonSocketInterface.h" -#include "BluetoothInterfaceHelpers.h" #include "mozilla/ipc/DaemonRunnables.h" #include "mozilla/ipc/DaemonSocket.h" #include "mozilla/ipc/ListenSocket.h" diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h index e99d2807f5d9..144c2c0beed5 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h @@ -9,7 +9,6 @@ #include "BluetoothDaemonHelpers.h" #include "BluetoothInterface.h" -#include "BluetoothInterfaceHelpers.h" #include "mozilla/ipc/DaemonRunnables.h" BEGIN_BLUETOOTH_NAMESPACE diff --git a/dom/bluetooth/moz.build b/dom/bluetooth/moz.build index d1e1de12bc30..49a1b1e713a7 100644 --- a/dom/bluetooth/moz.build +++ b/dom/bluetooth/moz.build @@ -13,7 +13,6 @@ if CONFIG['MOZ_B2G_BT']: SOURCES += [ 'BluetoothHidManager.cpp', 'BluetoothInterface.cpp', - 'BluetoothInterfaceHelpers.cpp', 'BluetoothUtils.cpp', 'BluetoothUuid.cpp', 'ObexBase.cpp'