| Index: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
|
| diff --git a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
|
| index e8bfd64563bdf251b212300efc866d168e273907..d6591b23e0126d68b917f3824ef3965e0adb32e3 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
|
| @@ -24,7 +24,7 @@ BluetoothDevice::BluetoothDevice(ExecutionContext* context,
|
| : ContextLifecycleObserver(context),
|
| m_attributeInstanceMap(new BluetoothAttributeInstanceMap(this)),
|
| m_device(std::move(device)),
|
| - m_gatt(BluetoothRemoteGATTServer::create(this)),
|
| + m_gatt(BluetoothRemoteGATTServer::create(context, this)),
|
| m_bluetooth(bluetooth) {}
|
|
|
| // static
|
| @@ -75,28 +75,7 @@ bool BluetoothDevice::isValidDescriptor(const String& descriptorInstanceId) {
|
| return m_attributeInstanceMap->containsDescriptor(descriptorInstanceId);
|
| }
|
|
|
| -void BluetoothDevice::dispose() {
|
| - disconnectGATTIfConnected();
|
| -}
|
| -
|
| -void BluetoothDevice::contextDestroyed(ExecutionContext*) {
|
| - disconnectGATTIfConnected();
|
| -}
|
| -
|
| -void BluetoothDevice::disconnectGATTIfConnected() {
|
| - if (m_gatt->connected()) {
|
| - m_gatt->setConnected(false);
|
| - m_gatt->ClearActiveAlgorithms();
|
| - m_bluetooth->removeFromConnectedDevicesMap(id());
|
| - mojom::blink::WebBluetoothService* service = m_bluetooth->service();
|
| - service->RemoteServerDisconnect(id());
|
| - }
|
| -}
|
| -
|
| -void BluetoothDevice::cleanupDisconnectedDeviceAndFireEvent() {
|
| - DCHECK(m_gatt->connected());
|
| - m_gatt->setConnected(false);
|
| - m_gatt->ClearActiveAlgorithms();
|
| +void BluetoothDevice::clearAttributeInstanceMapAndFireEvent() {
|
| m_attributeInstanceMap->Clear();
|
| dispatchEvent(Event::createBubble(EventTypeNames::gattserverdisconnected));
|
| }
|
| @@ -109,13 +88,6 @@ ExecutionContext* BluetoothDevice::getExecutionContext() const {
|
| return ContextLifecycleObserver::getExecutionContext();
|
| }
|
|
|
| -void BluetoothDevice::dispatchGattServerDisconnected() {
|
| - if (!m_gatt->connected()) {
|
| - return;
|
| - }
|
| - cleanupDisconnectedDeviceAndFireEvent();
|
| -}
|
| -
|
| DEFINE_TRACE(BluetoothDevice) {
|
| visitor->trace(m_attributeInstanceMap);
|
| visitor->trace(m_gatt);
|
|
|