Backed out changeset ef9e220beb2d (bug 1250694)
authorBruce Sun <brsun@mozilla.com>
Fri, 04 Mar 2016 18:54:26 +0800
changeset 323115 6c45a9d2befe35255d78689a35ac5396ff2bf8f6
parent 323114 e5d1a341c37aa46e4ccdca652976b89eafaf99fb
child 323116 e6c79a311b798e2f2adea13e5badb367678bb89c
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1250694
milestone47.0a1
backs outef9e220beb2d1502c0f60cb9e1ac6351e8a9c0fb
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
Backed out changeset ef9e220beb2d (bug 1250694)
dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
dom/bluetooth/bluedroid/BluetoothGattManager.cpp
dom/bluetooth/common/BluetoothCommon.cpp
dom/bluetooth/common/BluetoothCommon.h
dom/bluetooth/common/BluetoothUtils.cpp
--- a/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
@@ -15,17 +15,17 @@ using namespace mozilla::ipc;
 // Handsfree module
 //
 
 BluetoothHandsfreeNotificationHandler*
   BluetoothDaemonHandsfreeModule::sNotificationHandler;
 
 #if ANDROID_VERSION < 21
 BluetoothAddress BluetoothDaemonHandsfreeModule::sConnectedDeviceAddress(
-  BluetoothAddress::ANY());
+  BluetoothAddress::ANY);
 #endif
 
 void
 BluetoothDaemonHandsfreeModule::SetNotificationHandler(
   BluetoothHandsfreeNotificationHandler* aNotificationHandler)
 {
   sNotificationHandler = aNotificationHandler;
 }
@@ -755,17 +755,17 @@ public:
     if (NS_FAILED(rv)) {
       return rv;
     }
 
 #if ANDROID_VERSION < 21
     if (aArg1 == HFP_CONNECTION_STATE_CONNECTED) {
       sConnectedDeviceAddress = aArg2;
     } else if (aArg1 == HFP_CONNECTION_STATE_DISCONNECTED) {
-      sConnectedDeviceAddress = BluetoothAddress::ANY();
+      sConnectedDeviceAddress = BluetoothAddress::ANY;
     }
 #endif
     WarnAboutTrailingData();
     return NS_OK;
   }
 };
 
 void
--- a/dom/bluetooth/bluedroid/BluetoothGattManager.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothGattManager.cpp
@@ -893,17 +893,17 @@ BluetoothGattManager::StartLeScan(const 
   if (NS_WARN_IF(index != sClients->NoIndex)) {
     DispatchReplyError(aRunnable,
                        NS_LITERAL_STRING("start LE scan failed"));
     return;
   }
 
   index = sClients->Length();
   sClients->AppendElement(new BluetoothGattClient(appUuid,
-                                                  BluetoothAddress::ANY()));
+                                                  BluetoothAddress::ANY));
   RefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
   client->mStartLeScanRunnable = aRunnable;
 
   // 'startLeScan' will be proceeded after client registered
   sBluetoothGattInterface->RegisterClient(
     appUuid, new RegisterClientResultHandler(client));
 }
 
@@ -1031,17 +1031,17 @@ BluetoothGattManager::StartAdvertising(
   if (NS_WARN_IF(index != sClients->NoIndex)) {
     DispatchReplyError(aRunnable,
                        NS_LITERAL_STRING("start advertising failed"));
     return;
   }
 
   index = sClients->Length();
   sClients->AppendElement(new BluetoothGattClient(aAppUuid,
-                                                  BluetoothAddress::ANY()));
+                                                  BluetoothAddress::ANY));
   RefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
   client->mStartAdvertisingRunnable = aRunnable;
   client->mAdvertisingData = aData;
 
   // 'startAdvertising' will be proceeded after client registered
   sBluetoothGattInterface->RegisterClient(
     aAppUuid, new RegisterClientResultHandler(client));
 }
--- a/dom/bluetooth/common/BluetoothCommon.cpp
+++ b/dom/bluetooth/common/BluetoothCommon.cpp
@@ -11,58 +11,41 @@
 bool gBluetoothDebugFlag = false;
 
 BEGIN_BLUETOOTH_NAMESPACE
 
 //
 // |BluetoothAddress|
 //
 
-const BluetoothAddress& BluetoothAddress::ANY()
-{
-  static const BluetoothAddress sAddress(0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
-  return sAddress;
-}
+const BluetoothAddress BluetoothAddress::ANY(0x00, 0x00, 0x00,
+                                             0x00, 0x00, 0x00);
 
-const BluetoothAddress& BluetoothAddress::ALL()
-{
-  static const BluetoothAddress sAddress(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
-  return sAddress;
-}
+const BluetoothAddress BluetoothAddress::ALL(0xff, 0xff, 0xff,
+                                             0xff, 0xff, 0xff);
 
-const BluetoothAddress& BluetoothAddress::LOCAL()
-{
-  static const BluetoothAddress sAddress(0x00, 0x00, 0x00, 0xff, 0xff, 0xff);
-  return sAddress;
-}
+const BluetoothAddress BluetoothAddress::LOCAL(0x00, 0x00, 0x00,
+                                               0xff, 0xff, 0xff);
 
 //
 // |BluetoothUuid|
 //
 
-const BluetoothUuid& BluetoothUuid::ZERO()
-{
-  static const BluetoothUuid sUuid(0x00, 0x00, 0x00, 0x00,
-                                   0x00, 0x00, 0x00, 0x00,
-                                   0x00, 0x00, 0x00, 0x00,
-                                   0x00, 0x00, 0x00, 0x00);
-  return sUuid;
-}
+const BluetoothUuid BluetoothUuid::ZERO(0x00, 0x00, 0x00, 0x00,
+                                        0x00, 0x00, 0x00, 0x00,
+                                        0x00, 0x00, 0x00, 0x00,
+                                        0x00, 0x00, 0x00, 0x00);
 
 /*
  * [Bluetooth Specification Version 4.2, Volume 3, Part B, Section 2.5.1]
  *
  * To reduce the burden of storing and transferring 128-bit UUID values, a
  * range of UUID values has been pre-allocated for assignment to often-used,
  * registered purposes. The first UUID in this pre-allocated range is known as
  * the Bluetooth Base UUID and has the value 00000000-0000-1000-8000-
  * 00805F9B34FB, from the Bluetooth Assigned Numbers document.
  */
-const BluetoothUuid& BluetoothUuid::BASE()
-{
-  static const BluetoothUuid sUuid(0x00, 0x00, 0x00, 0x00,
-                                   0x00, 0x00, 0x10, 0x00,
-                                   0x80, 0x00, 0x00, 0x80,
-                                   0x5f, 0x9b, 0x34, 0xfb);
-  return sUuid;
-}
+const BluetoothUuid BluetoothUuid::BASE(0x00, 0x00, 0x00, 0x00,
+                                        0x00, 0x00, 0x10, 0x00,
+                                        0x80, 0x00, 0x00, 0x80,
+                                        0x5f, 0x9b, 0x34, 0xfb);
 
 END_BLUETOOTH_NAMESPACE
--- a/dom/bluetooth/common/BluetoothCommon.h
+++ b/dom/bluetooth/common/BluetoothCommon.h
@@ -403,29 +403,30 @@ struct BluetoothActivityEnergyInfo {
   uint64_t mTxTime;     /* in ms */
   uint64_t mRxTime;     /* in ms */
   uint64_t mIdleTime;   /* in ms */
   uint64_t mEnergyUsed; /* a product of mA, V and ms */
 };
 
 /**
  * |BluetoothAddress| stores the 6-byte MAC address of a Bluetooth
- * device. The constants returned from ANY(), ALL() and LOCAL()
- * represent addresses with special meaning.
+ * device. The constants ANY, ALL and LOCAL represent addresses with
+ * special meaning.
  */
 struct BluetoothAddress {
-  static const BluetoothAddress& ANY();
-  static const BluetoothAddress& ALL();
-  static const BluetoothAddress& LOCAL();
+
+  static const BluetoothAddress ANY;
+  static const BluetoothAddress ALL;
+  static const BluetoothAddress LOCAL;
 
   uint8_t mAddr[6];
 
   BluetoothAddress()
   {
-    Clear(); // assign ANY()
+    Clear(); // assign ANY
   }
 
   MOZ_IMPLICIT BluetoothAddress(const BluetoothAddress&) = default;
 
   BluetoothAddress(uint8_t aAddr0, uint8_t aAddr1,
                    uint8_t aAddr2, uint8_t aAddr3,
                    uint8_t aAddr4, uint8_t aAddr5)
   {
@@ -445,30 +446,30 @@ struct BluetoothAddress {
   }
 
   bool operator!=(const BluetoothAddress& aRhs) const
   {
     return !operator==(aRhs);
   }
 
   /**
-   * |Clear| assigns an invalid value (i.e., ANY()) to the address.
+   * |Clear| assigns an invalid value (i.e., ANY) to the address.
    */
   void Clear()
   {
-    operator=(ANY());
+    operator=(ANY);
   }
 
   /**
-   * |IsCleared| returns true if the address does not contain a
-   * specific value (i.e., it contains ANY()).
+   * |IsCleared| returns true if the address doesn not contain a
+   * specific value (i.e., it contains ANY).
    */
   bool IsCleared() const
   {
-    return operator==(ANY());
+    return operator==(ANY);
   }
 
   /*
    * Getter and setter methods for the address parts. The figure
    * below illustrates the mapping to bytes; from LSB to MSB.
    *
    *    |       LAP       | UAP |    NAP    |
    *    |  0  |  1  |  2  |  3  |  4  |  5  |
@@ -544,23 +545,23 @@ enum BluetoothServiceClass {
   HID              = 0x1124,
   PBAP_PCE         = 0x112e,
   PBAP_PSE         = 0x112f,
   MAP_MAS          = 0x1132,
   MAP_MNS          = 0x1133
 };
 
 struct BluetoothUuid {
-  static const BluetoothUuid& ZERO();
-  static const BluetoothUuid& BASE();
+  static const BluetoothUuid ZERO;
+  static const BluetoothUuid BASE;
 
   uint8_t mUuid[16];  // store 128-bit UUID value in big-endian order
 
   BluetoothUuid()
-    : BluetoothUuid(ZERO())
+    : BluetoothUuid(ZERO)
   { }
 
   MOZ_IMPLICIT BluetoothUuid(const BluetoothUuid&) = default;
 
   BluetoothUuid(uint8_t aUuid0, uint8_t aUuid1,
                 uint8_t aUuid2, uint8_t aUuid3,
                 uint8_t aUuid4, uint8_t aUuid5,
                 uint8_t aUuid6, uint8_t aUuid7,
@@ -604,26 +605,26 @@ struct BluetoothUuid {
 
   BluetoothUuid& operator=(const BluetoothUuid& aRhs) = default;
 
   /**
    * |Clear| assigns an invalid value (i.e., zero) to the UUID.
    */
   void Clear()
   {
-    operator=(ZERO());
+    operator=(ZERO);
   }
 
   /**
    * |IsCleared| returns true if the UUID contains a value of
    * zero.
    */
   bool IsCleared() const
   {
-    return operator==(ZERO());
+    return operator==(ZERO);
   }
 
   bool operator==(const BluetoothUuid& aRhs) const
   {
     return std::equal(aRhs.mUuid,
                       aRhs.mUuid + MOZ_ARRAY_LENGTH(aRhs.mUuid), mUuid);
   }
 
@@ -644,28 +645,28 @@ struct BluetoothUuid {
    * and 4 (indices 2 and 3) are represented by UUID16. The rest of
    * the UUID is filled with the Bluetooth Base UUID.
    *
    * Below are helpers for accessing these values.
    */
 
   void SetUuid32(uint32_t aUuid32)
   {
-    operator=(BASE());
+    operator=(BASE);
     BigEndian::writeUint32(&mUuid[0], aUuid32);
   }
 
   uint32_t GetUuid32() const
   {
     return BigEndian::readUint32(&mUuid[0]);
   }
 
   void SetUuid16(uint16_t aUuid16)
   {
-    operator=(BASE());
+    operator=(BASE);
     BigEndian::writeUint16(&mUuid[2], aUuid16);
   }
 
   uint16_t GetUuid16() const
   {
     return BigEndian::readUint16(&mUuid[2]);
   }
 };
--- a/dom/bluetooth/common/BluetoothUtils.cpp
+++ b/dom/bluetooth/common/BluetoothUtils.cpp
@@ -299,17 +299,17 @@ BytesToUuid(const nsTArray<uint8_t>& aAr
   } else {
     length = MOZ_ARRAY_LENGTH(aUuid.mUuid);
   }
 
   if (aArray.Length() < aOffset + length) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
-  aUuid = BluetoothUuid::BASE();
+  aUuid = BluetoothUuid::BASE;
 
   if (aEndian == ENDIAN_BIG) {
     for (size_t i = 0; i < length; ++i) {
       aUuid.mUuid[index + i] = aArray[aOffset + i];
     }
   } else {
     for (size_t i = 0; i < length; ++i) {
       aUuid.mUuid[index + i] = aArray[aOffset + length - i - 1];