Merge m-c to b2g-inbound. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 27 Jul 2015 15:52:27 -0400
changeset 286465 4768c0ddb601133f9576ebade7dca1d6fc3e264c
parent 286464 13354b41439620ff3628db12d1451f77fd5db3ad (current diff)
parent 286454 5856a328963dcbd797a1e8ab64f4e41906b6633a (diff)
child 286466 1b168b0cfdf07548fe413a46fc16195e478a111b
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone42.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
Merge m-c to b2g-inbound. a=merge
dom/bluetooth/bluetooth2/BluetoothGattServer.cpp
dom/bluetooth/bluetooth2/BluetoothGattServer.h
dom/webidl/BluetoothGattServer.webidl
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -169,20 +169,16 @@ DOMInterfaces = {
 'BluetoothGattCharacteristic': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothGattCharacteristic',
 },
 
 'BluetoothGattDescriptor': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothGattDescriptor',
 },
 
-'BluetoothGattServer': {
-    'nativeType': 'mozilla::dom::bluetooth::BluetoothGattServer',
-},
-
 'BluetoothGattService': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothGattService',
 },
 
 'BluetoothLeDeviceEvent': {
     'nativeType': 'mozilla::dom::bluetooth::BluetoothLeDeviceEvent',
 },
 
--- a/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp
+++ b/dom/bluetooth/bluetooth2/BluetoothAdapter.cpp
@@ -17,17 +17,16 @@
 #include "mozilla/dom/BluetoothStatusChangedEvent.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/File.h"
 
 #include "mozilla/dom/bluetooth/BluetoothAdapter.h"
 #include "mozilla/dom/bluetooth/BluetoothClassOfDevice.h"
 #include "mozilla/dom/bluetooth/BluetoothDevice.h"
 #include "mozilla/dom/bluetooth/BluetoothDiscoveryHandle.h"
-#include "mozilla/dom/bluetooth/BluetoothGattServer.h"
 #include "mozilla/dom/bluetooth/BluetoothPairingListener.h"
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 USING_BLUETOOTH_NAMESPACE
 
@@ -357,37 +356,16 @@ BluetoothAdapter::Cleanup()
       nsRefPtr<BluetoothVoidReplyRunnable> results =
         new BluetoothVoidReplyRunnable(nullptr);
       bs->StopLeScanInternal(uuid, results);
     }
     mLeScanHandleArray.Clear();
   }
 }
 
-BluetoothGattServer*
-BluetoothAdapter::GetGattServer()
-{
-  /* Only expose GATT server if the adapter is enabled. It would be worth
-   * noting that the enabling state and the disabling state are just
-   * intermediate states, and the adapter would change into the enabled state
-   * or the disabled state sooner or later. So we invalidate and nullify the
-   * created GATT server object only when the adapter changes to a steady
-   * state, i.e., the disabled state.
-   */
-  if (mState != BluetoothAdapterState::Enabled) {
-    return nullptr;
-  }
-
-  if (!mGattServer) {
-    mGattServer = new BluetoothGattServer(GetOwner());
-  }
-
-  return mGattServer;
-}
-
 void
 BluetoothAdapter::GetPairedDeviceProperties(
   const nsTArray<nsString>& aDeviceAddresses)
 {
   BluetoothService* bs = BluetoothService::Get();
   NS_ENSURE_TRUE_VOID(bs);
 
   nsRefPtr<BluetoothVoidReplyRunnable> results =
@@ -408,20 +386,16 @@ BluetoothAdapter::SetPropertyByValue(con
   if (name.EqualsLiteral("State")) {
     mState = value.get_bool() ? BluetoothAdapterState::Enabled
                               : BluetoothAdapterState::Disabled;
 
     // Clear saved devices and LE scan handles when state changes to disabled
     if (mState == BluetoothAdapterState::Disabled) {
       mDevices.Clear();
       mLeScanHandleArray.Clear();
-      if (mGattServer) {
-        mGattServer->Invalidate();
-        mGattServer = nullptr;
-      }
     }
   } else if (name.EqualsLiteral("Name")) {
     mName = value.get_nsString();
   } else if (name.EqualsLiteral("Address")) {
     mAddress = value.get_nsString();
   } else if (name.EqualsLiteral("Discoverable")) {
     mDiscoverable = value.get_bool();
   } else if (name.EqualsLiteral("Discovering")) {
@@ -995,23 +969,16 @@ void
 BluetoothAdapter::SetAdapterState(BluetoothAdapterState aState)
 {
   if (mState == aState) {
     return;
   }
 
   mState = aState;
 
-  if (mState == BluetoothAdapterState::Disabled) {
-    if (mGattServer) {
-      mGattServer->Invalidate();
-      mGattServer = nullptr;
-    }
-  }
-
   // Fire BluetoothAttributeEvent for changed adapter state
   Sequence<nsString> types;
   BT_APPEND_ENUM_STRING_FALLIBLE(types,
                                  BluetoothAdapterAttribute,
                                  BluetoothAdapterAttribute::State);
   DispatchAttributeEvent(types);
 }
 
--- a/dom/bluetooth/bluetooth2/BluetoothAdapter.h
+++ b/dom/bluetooth/bluetooth2/BluetoothAdapter.h
@@ -23,17 +23,16 @@ struct MediaMetaData;
 struct MediaPlayStatus;
 }
 }
 
 BEGIN_BLUETOOTH_NAMESPACE
 
 class BluetoothDevice;
 class BluetoothDiscoveryHandle;
-class BluetoothGattServer;
 class BluetoothNamedValue;
 class BluetoothPairingListener;
 class BluetoothSignal;
 class BluetoothValue;
 
 class BluetoothAdapter : public DOMEventTargetHelper
                        , public BluetoothSignalObserver
 {
@@ -73,18 +72,16 @@ public:
     return mDiscoverable;
   }
 
   BluetoothPairingListener* PairingReqs() const
   {
     return mPairingReqs;
   }
 
-  BluetoothGattServer* GetGattServer();
-
   /****************************************************************************
    * Event Handlers
    ***************************************************************************/
   IMPL_EVENT_HANDLER(attributechanged);
   IMPL_EVENT_HANDLER(devicepaired);
   IMPL_EVENT_HANDLER(deviceunpaired);
   IMPL_EVENT_HANDLER(pairingaborted);
   IMPL_EVENT_HANDLER(a2dpstatuschanged);
@@ -356,28 +353,16 @@ private:
   bool mDiscoverable;
 
   /**
    * Whether this adapter is discovering nearby devices.
    */
   bool mDiscovering;
 
   /**
-   * GATT server object of this adapter.
-   *
-   * A new GATT server object will be created at the first time when
-   * |GetGattServer| is called after the adapter has been enabled. If the
-   * adapter has been disabled later on, the created GATT server will be
-   * discard by the adapter, and this GATT object should stop working till the
-   * end of its life. When |GetGattServer| is called after the adapter has been
-   * enabled again, a new GATT server object will be created.
-   */
-  nsRefPtr<BluetoothGattServer> mGattServer;
-
-  /**
    * Handle to fire pairing requests of different pairing types.
    */
   nsRefPtr<BluetoothPairingListener> mPairingReqs;
 
   /**
    * Handle to fire 'ondevicefound' event handler for discovered device.
    *
    * This variable is set to the latest discovery handle when adapter just
deleted file mode 100644
--- a/dom/bluetooth/bluetooth2/BluetoothGattServer.cpp
+++ /dev/null
@@ -1,50 +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 "BluetoothGattServer.h"
-
-using namespace mozilla;
-using namespace mozilla::dom;
-
-USING_BLUETOOTH_NAMESPACE
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(BluetoothGattServer,
-                                      mOwner)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(BluetoothGattServer)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(BluetoothGattServer)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BluetoothGattServer)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-BluetoothGattServer::BluetoothGattServer(nsPIDOMWindow* aOwner)
-  : mOwner(aOwner)
-  , mValid(true)
-{
-}
-
-BluetoothGattServer::~BluetoothGattServer()
-{
-  Invalidate();
-}
-
-JSObject*
-BluetoothGattServer::WrapObject(JSContext* aContext,
-                                JS::Handle<JSObject*> aGivenProto)
-{
-  return BluetoothGattServerBinding::Wrap(aContext, this, aGivenProto);
-}
-
-void
-BluetoothGattServer::Invalidate()
-{
-  mValid = false;
-
-  /* TODO: add tear down stuff here */
-
-  return;
-}
\ No newline at end of file
deleted file mode 100644
--- a/dom/bluetooth/bluetooth2/BluetoothGattServer.h
+++ /dev/null
@@ -1,69 +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_bluetoothgattserver_h__
-#define mozilla_dom_bluetooth_bluetoothgattserver_h__
-
-#include "mozilla/dom/BluetoothGattServerBinding.h"
-#include "mozilla/dom/bluetooth/BluetoothCommon.h"
-#include "nsCOMPtr.h"
-#include "nsPIDOMWindow.h"
-#include "nsWrapperCache.h"
-
-BEGIN_BLUETOOTH_NAMESPACE
-
-class BluetoothGattServer final : public nsISupports
-                                , public nsWrapperCache
-{
-public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(BluetoothGattServer)
-
-  /****************************************************************************
-   * Attribute Getters
-   ***************************************************************************/
-
-  /****************************************************************************
-   * Event Handlers
-   ***************************************************************************/
-
-  /****************************************************************************
-   * Methods (Web API Implementation)
-   ***************************************************************************/
-
-  /****************************************************************************
-   * Others
-   ***************************************************************************/
-  nsPIDOMWindow* GetParentObject() const
-  {
-     return mOwner;
-  }
-
-  virtual JSObject* WrapObject(JSContext* aCx,
-                               JS::Handle<JSObject*> aGivenProto) override;
-
-  BluetoothGattServer(nsPIDOMWindow* aOwner);
-
-  /* Invalidate the GATT server.
-   * If the BluetoothAdapter turns off, existing BluetoothGattServer instances
-   * should stop working till the end of life.
-   */
-  void Invalidate();
-
-private:
-  ~BluetoothGattServer();
-
-  /****************************************************************************
-   * Variables
-   ***************************************************************************/
-  nsCOMPtr<nsPIDOMWindow> mOwner;
-
-  bool mValid;
-};
-
-END_BLUETOOTH_NAMESPACE
-
-#endif
--- a/dom/bluetooth/moz.build
+++ b/dom/bluetooth/moz.build
@@ -46,17 +46,16 @@ if CONFIG['MOZ_B2G_BT']:
         SOURCES += [
             'bluetooth2/BluetoothAdapter.cpp',
             'bluetooth2/BluetoothClassOfDevice.cpp',
             'bluetooth2/BluetoothDevice.cpp',
             'bluetooth2/BluetoothDiscoveryHandle.cpp',
             'bluetooth2/BluetoothGatt.cpp',
             'bluetooth2/BluetoothGattCharacteristic.cpp',
             'bluetooth2/BluetoothGattDescriptor.cpp',
-            'bluetooth2/BluetoothGattServer.cpp',
             'bluetooth2/BluetoothGattService.cpp',
             'bluetooth2/BluetoothLeDeviceEvent.cpp',
             'bluetooth2/BluetoothManager.cpp',
             'bluetooth2/BluetoothPairingHandle.cpp',
             'bluetooth2/BluetoothPairingListener.cpp',
             'bluetooth2/BluetoothProfileController.cpp',
             'bluetooth2/BluetoothReplyRunnable.cpp',
             'bluetooth2/BluetoothService.cpp',
@@ -185,17 +184,16 @@ else:
     EXPORTS.mozilla.dom.bluetooth += [
         'bluetooth2/BluetoothAdapter.h',
         'bluetooth2/BluetoothClassOfDevice.h',
         'bluetooth2/BluetoothDevice.h',
         'bluetooth2/BluetoothDiscoveryHandle.h',
         'bluetooth2/BluetoothGatt.h',
         'bluetooth2/BluetoothGattCharacteristic.h',
         'bluetooth2/BluetoothGattDescriptor.h',
-        'bluetooth2/BluetoothGattServer.h',
         'bluetooth2/BluetoothGattService.h',
         'bluetooth2/BluetoothLeDeviceEvent.h',
         'bluetooth2/BluetoothManager.h',
         'bluetooth2/BluetoothPairingHandle.h',
         'bluetooth2/BluetoothPairingListener.h',
     ]
     IPDL_SOURCES += [
         'bluetooth2/ipc/BluetoothTypes.ipdlh',
--- a/dom/webidl/BluetoothAdapter2.webidl
+++ b/dom/webidl/BluetoothAdapter2.webidl
@@ -35,17 +35,16 @@ dictionary MediaPlayStatus
 [CheckAnyPermissions="bluetooth"]
 interface BluetoothAdapter : EventTarget {
   readonly attribute BluetoothAdapterState  state;
   [AvailableIn=CertifiedApps]
   readonly attribute DOMString              address;
   readonly attribute DOMString              name;
   readonly attribute boolean                discoverable;
   readonly attribute boolean                discovering;
-  readonly attribute BluetoothGattServer?   gattServer;
 
   [AvailableIn=CertifiedApps]
   readonly attribute BluetoothPairingListener pairingReqs;
 
   // Fired when attribute(s) of BluetoothAdapter changed
            attribute EventHandler   onattributechanged;
 
   // Fired when a remote device gets paired with the adapter
deleted file mode 100644
--- a/dom/webidl/BluetoothGattServer.webidl
+++ /dev/null
@@ -1,13 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/.
- */
-
-[CheckAnyPermissions="bluetooth"]
-interface BluetoothGattServer
-{
-  /* The implementation of BluetoothGattServer will come later.
-   * (see dependent bugs of bug 933358)
-   */
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -668,17 +668,16 @@ if CONFIG['MOZ_B2G_BT']:
         WEBIDL_FILES += [
             'BluetoothAdapter2.webidl',
             'BluetoothClassOfDevice.webidl',
             'BluetoothDevice2.webidl',
             'BluetoothDiscoveryHandle.webidl',
             'BluetoothGatt.webidl',
             'BluetoothGattCharacteristic.webidl',
             'BluetoothGattDescriptor.webidl',
-            'BluetoothGattServer.webidl',
             'BluetoothGattService.webidl',
             'BluetoothLeDeviceEvent.webidl',
             'BluetoothManager2.webidl',
             'BluetoothPairingHandle.webidl',
             'BluetoothPairingListener.webidl',
         ]
 
 if CONFIG['MOZ_SIMPLEPUSH']: