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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTCharacteristic( | 58 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTCharacteristic( |
59 context, std::move(webCharacteristic), service); | 59 context, std::move(webCharacteristic), service); |
60 } | 60 } |
61 | 61 |
62 bool BluetoothDevice::isValidCharacteristic( | 62 bool BluetoothDevice::isValidCharacteristic( |
63 const String& characteristicInstanceId) { | 63 const String& characteristicInstanceId) { |
64 return m_attributeInstanceMap->containsCharacteristic( | 64 return m_attributeInstanceMap->containsCharacteristic( |
65 characteristicInstanceId); | 65 characteristicInstanceId); |
66 } | 66 } |
67 | 67 |
| 68 BluetoothRemoteGATTDescriptor* |
| 69 BluetoothDevice::getOrCreateBluetoothRemoteGATTDescriptor( |
| 70 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> webDescriptor, |
| 71 BluetoothRemoteGATTCharacteristic* characteristic) { |
| 72 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTDescriptor( |
| 73 std::move(webDescriptor), characteristic); |
| 74 } |
| 75 |
| 76 bool BluetoothDevice::isValidDescriptor(const String& descriptorInstanceId) { |
| 77 return m_attributeInstanceMap->containsDescriptor(descriptorInstanceId); |
| 78 } |
| 79 |
68 void BluetoothDevice::dispose() { | 80 void BluetoothDevice::dispose() { |
69 disconnectGATTIfConnected(); | 81 disconnectGATTIfConnected(); |
70 } | 82 } |
71 | 83 |
72 void BluetoothDevice::contextDestroyed() { | 84 void BluetoothDevice::contextDestroyed() { |
73 disconnectGATTIfConnected(); | 85 disconnectGATTIfConnected(); |
74 } | 86 } |
75 | 87 |
76 void BluetoothDevice::disconnectGATTIfConnected() { | 88 void BluetoothDevice::disconnectGATTIfConnected() { |
77 if (m_gatt->connected()) { | 89 if (m_gatt->connected()) { |
(...skipping 28 matching lines...) Expand all Loading... |
106 } | 118 } |
107 | 119 |
108 DEFINE_TRACE(BluetoothDevice) { | 120 DEFINE_TRACE(BluetoothDevice) { |
109 EventTargetWithInlineData::trace(visitor); | 121 EventTargetWithInlineData::trace(visitor); |
110 ContextLifecycleObserver::trace(visitor); | 122 ContextLifecycleObserver::trace(visitor); |
111 visitor->trace(m_attributeInstanceMap); | 123 visitor->trace(m_attributeInstanceMap); |
112 visitor->trace(m_gatt); | 124 visitor->trace(m_gatt); |
113 } | 125 } |
114 | 126 |
115 } // namespace blink | 127 } // namespace blink |
OLD | NEW |