Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothDevice.cpp

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Remove macos restriction Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTCharacteristic( 56 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTCharacteristic(
57 context, std::move(webCharacteristic), service); 57 context, std::move(webCharacteristic), service);
58 } 58 }
59 59
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 BluetoothRemoteGATTDescriptor*
67 BluetoothDevice::getOrCreateBluetoothRemoteGATTDescriptor(
68 std::unique_ptr<WebBluetoothRemoteGATTDescriptorInit> webDescriptor,
69 BluetoothRemoteGATTCharacteristic* characteristic) {
70 return m_attributeInstanceMap->getOrCreateBluetoothRemoteGATTDescriptor(
71 std::move(webDescriptor), characteristic);
72 }
73
66 void BluetoothDevice::dispose() { 74 void BluetoothDevice::dispose() {
67 disconnectGATTIfConnected(); 75 disconnectGATTIfConnected();
68 } 76 }
69 77
70 void BluetoothDevice::contextDestroyed() { 78 void BluetoothDevice::contextDestroyed() {
71 disconnectGATTIfConnected(); 79 disconnectGATTIfConnected();
72 } 80 }
73 81
74 void BluetoothDevice::disconnectGATTIfConnected() { 82 void BluetoothDevice::disconnectGATTIfConnected() {
75 if (m_gatt->connected()) { 83 if (m_gatt->connected()) {
(...skipping 28 matching lines...) Expand all
104 } 112 }
105 113
106 DEFINE_TRACE(BluetoothDevice) { 114 DEFINE_TRACE(BluetoothDevice) {
107 EventTargetWithInlineData::trace(visitor); 115 EventTargetWithInlineData::trace(visitor);
108 ContextLifecycleObserver::trace(visitor); 116 ContextLifecycleObserver::trace(visitor);
109 visitor->trace(m_attributeInstanceMap); 117 visitor->trace(m_attributeInstanceMap);
110 visitor->trace(m_gatt); 118 visitor->trace(m_gatt);
111 } 119 }
112 120
113 } // namespace blink 121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698