| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 bool BluetoothDevice::isValidCharacteristic( | 60 bool BluetoothDevice::isValidCharacteristic( |
| 61 const String& characteristicInstanceId) { | 61 const String& characteristicInstanceId) { |
| 62 return m_attributeInstanceMap->containsCharacteristic( | 62 return m_attributeInstanceMap->containsCharacteristic( |
| 63 characteristicInstanceId); | 63 characteristicInstanceId); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void BluetoothDevice::dispose() { | 66 void BluetoothDevice::dispose() { |
| 67 disconnectGATTIfConnected(); | 67 disconnectGATTIfConnected(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void BluetoothDevice::contextDestroyed() { | 70 void BluetoothDevice::contextDestroyed(ExecutionContext*) { |
| 71 disconnectGATTIfConnected(); | 71 disconnectGATTIfConnected(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void BluetoothDevice::disconnectGATTIfConnected() { | 74 void BluetoothDevice::disconnectGATTIfConnected() { |
| 75 if (m_gatt->connected()) { | 75 if (m_gatt->connected()) { |
| 76 m_gatt->setConnected(false); | 76 m_gatt->setConnected(false); |
| 77 m_gatt->ClearActiveAlgorithms(); | 77 m_gatt->ClearActiveAlgorithms(); |
| 78 m_bluetooth->removeDevice(id()); | 78 m_bluetooth->removeDevice(id()); |
| 79 mojom::blink::WebBluetoothService* service = m_bluetooth->service(); | 79 mojom::blink::WebBluetoothService* service = m_bluetooth->service(); |
| 80 service->RemoteServerDisconnect(id()); | 80 service->RemoteServerDisconnect(id()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 106 | 106 |
| 107 DEFINE_TRACE(BluetoothDevice) { | 107 DEFINE_TRACE(BluetoothDevice) { |
| 108 visitor->trace(m_attributeInstanceMap); | 108 visitor->trace(m_attributeInstanceMap); |
| 109 visitor->trace(m_gatt); | 109 visitor->trace(m_gatt); |
| 110 visitor->trace(m_bluetooth); | 110 visitor->trace(m_bluetooth); |
| 111 EventTargetWithInlineData::trace(visitor); | 111 EventTargetWithInlineData::trace(visitor); |
| 112 ContextLifecycleObserver::trace(visitor); | 112 ContextLifecycleObserver::trace(visitor); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace blink | 115 } // namespace blink |
| OLD | NEW |