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 6d0405acd0ed452cb12a034d0a912b0e7e104695..5449f8ca4f7da83ba208221e2467f6c84b78280b 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); |