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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothRemoteGATTService.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/BluetoothRemoteGATTService.h" 5 #include "modules/bluetooth/BluetoothRemoteGATTService.h"
6 6
7 #include "bindings/core/v8/ScriptPromise.h" 7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h" 8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h" 9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h" 10 #include "core/dom/ExceptionCode.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 class GetCharacteristicsCallback 48 class GetCharacteristicsCallback
49 : public WebBluetoothGetCharacteristicsCallbacks { 49 : public WebBluetoothGetCharacteristicsCallbacks {
50 public: 50 public:
51 GetCharacteristicsCallback( 51 GetCharacteristicsCallback(
52 BluetoothRemoteGATTService* service, 52 BluetoothRemoteGATTService* service,
53 mojom::blink::WebBluetoothGATTQueryQuantity quantity, 53 mojom::blink::WebBluetoothGATTQueryQuantity quantity,
54 ScriptPromiseResolver* resolver) 54 ScriptPromiseResolver* resolver)
55 : m_service(service), m_quantity(quantity), m_resolver(resolver) { 55 : m_service(service), m_quantity(quantity), m_resolver(resolver) {
56 // We always check that the device is connected before constructing this 56 // We always check that the device is connected before constructing this
57 // object. 57 // object.
58 CHECK(m_service->device()->gatt()->connected()); 58 DCHECK(m_service->device()->gatt()->connected());
59 m_service->device()->gatt()->AddToActiveAlgorithms(m_resolver.get()); 59 m_service->device()->gatt()->AddToActiveAlgorithms(m_resolver.get());
60 } 60 }
61 61
62 void onSuccess(const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>& 62 void onSuccess(const WebVector<WebBluetoothRemoteGATTCharacteristicInit*>&
63 webCharacteristics) override { 63 webCharacteristics) override {
64 if (!m_resolver->getExecutionContext() || 64 if (!m_resolver->getExecutionContext() ||
65 m_resolver->getExecutionContext()->isContextDestroyed()) 65 m_resolver->getExecutionContext()->isContextDestroyed())
66 return; 66 return;
67 67
68 // If the resolver is not in the set of ActiveAlgorithms then the frame 68 // If the resolver is not in the set of ActiveAlgorithms then the frame
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 BluetoothSupplement::fromScriptState(scriptState); 178 BluetoothSupplement::fromScriptState(scriptState);
179 webbluetooth->getCharacteristics( 179 webbluetooth->getCharacteristics(
180 m_webService->serviceInstanceID, static_cast<int32_t>(quantity), 180 m_webService->serviceInstanceID, static_cast<int32_t>(quantity),
181 characteristicsUUID, 181 characteristicsUUID,
182 new GetCharacteristicsCallback(this, quantity, resolver)); 182 new GetCharacteristicsCallback(this, quantity, resolver));
183 183
184 return promise; 184 return promise;
185 } 185 }
186 186
187 } // namespace blink 187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698