| 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 1b2008e1860d509bf5671d3eeaa8752e39731fdf..2fbb88fd7f6e473e0d698cea5b1e1e263972ef98 100644
|
| --- a/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
|
| +++ b/third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp
|
| @@ -45,6 +45,10 @@ BluetoothDevice::getOrCreateBluetoothRemoteGATTService(
|
| std::move(webService));
|
| }
|
|
|
| +bool BluetoothDevice::isValidService(const String& serviceInstanceId) {
|
| + return m_attributeInstanceMap->containsService(serviceInstanceId);
|
| +}
|
| +
|
| void BluetoothDevice::dispose() {
|
| disconnectGATTIfConnected();
|
| }
|
| @@ -53,15 +57,21 @@ void BluetoothDevice::contextDestroyed() {
|
| disconnectGATTIfConnected();
|
| }
|
|
|
| -bool BluetoothDevice::disconnectGATTIfConnected() {
|
| +void BluetoothDevice::disconnectGATTIfConnected() {
|
| if (m_gatt->connected()) {
|
| m_gatt->setConnected(false);
|
| m_gatt->ClearActiveAlgorithms();
|
| BluetoothSupplement::fromExecutionContext(getExecutionContext())
|
| ->disconnect(id());
|
| - return true;
|
| }
|
| - return false;
|
| +}
|
| +
|
| +void BluetoothDevice::cleanupDisconnectedDeviceAndFireEvent() {
|
| + DCHECK(m_gatt->connected());
|
| + m_gatt->setConnected(false);
|
| + m_gatt->ClearActiveAlgorithms();
|
| + m_attributeInstanceMap->Clear();
|
| + dispatchEvent(Event::createBubble(EventTypeNames::gattserverdisconnected));
|
| }
|
|
|
| const WTF::AtomicString& BluetoothDevice::interfaceName() const {
|
| @@ -73,11 +83,10 @@ ExecutionContext* BluetoothDevice::getExecutionContext() const {
|
| }
|
|
|
| void BluetoothDevice::dispatchGattServerDisconnected() {
|
| - if (m_gatt->connected()) {
|
| - m_gatt->setConnected(false);
|
| - m_gatt->ClearActiveAlgorithms();
|
| - dispatchEvent(Event::createBubble(EventTypeNames::gattserverdisconnected));
|
| + if (!m_gatt->connected()) {
|
| + return;
|
| }
|
| + cleanupDisconnectedDeviceAndFireEvent();
|
| }
|
|
|
| DEFINE_TRACE(BluetoothDevice) {
|
|
|