| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/bluetooth/BluetoothDevice.h" | 5 #include "modules/bluetooth/BluetoothDevice.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "core/dom/DOMException.h" | 10 #include "core/dom/DOMException.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 void BluetoothDevice::contextDestroyed(ExecutionContext*) { | 78 void BluetoothDevice::contextDestroyed(ExecutionContext*) { |
| 79 disconnectGATTIfConnected(); | 79 disconnectGATTIfConnected(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void BluetoothDevice::disconnectGATTIfConnected() { | 82 void BluetoothDevice::disconnectGATTIfConnected() { |
| 83 if (m_gatt->connected()) { | 83 if (m_gatt->connected()) { |
| 84 m_gatt->setConnected(false); | 84 m_gatt->setConnected(false); |
| 85 m_gatt->ClearActiveAlgorithms(); | 85 m_gatt->ClearActiveAlgorithms(); |
| 86 m_bluetooth->removeDevice(id()); | 86 m_bluetooth->removeFromConnectedDevicesMap(id()); |
| 87 mojom::blink::WebBluetoothService* service = m_bluetooth->service(); | 87 mojom::blink::WebBluetoothService* service = m_bluetooth->service(); |
| 88 service->RemoteServerDisconnect(id()); | 88 service->RemoteServerDisconnect(id()); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 void BluetoothDevice::cleanupDisconnectedDeviceAndFireEvent() { | 92 void BluetoothDevice::cleanupDisconnectedDeviceAndFireEvent() { |
| 93 DCHECK(m_gatt->connected()); | 93 DCHECK(m_gatt->connected()); |
| 94 m_gatt->setConnected(false); | 94 m_gatt->setConnected(false); |
| 95 m_gatt->ClearActiveAlgorithms(); | 95 m_gatt->ClearActiveAlgorithms(); |
| 96 m_attributeInstanceMap->Clear(); | 96 m_attributeInstanceMap->Clear(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 114 | 114 |
| 115 DEFINE_TRACE(BluetoothDevice) { | 115 DEFINE_TRACE(BluetoothDevice) { |
| 116 visitor->trace(m_attributeInstanceMap); | 116 visitor->trace(m_attributeInstanceMap); |
| 117 visitor->trace(m_gatt); | 117 visitor->trace(m_gatt); |
| 118 visitor->trace(m_bluetooth); | 118 visitor->trace(m_bluetooth); |
| 119 EventTargetWithInlineData::trace(visitor); | 119 EventTargetWithInlineData::trace(visitor); |
| 120 ContextLifecycleObserver::trace(visitor); | 120 ContextLifecycleObserver::trace(visitor); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| OLD | NEW |