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

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

Issue 1922923002: bluetooth: Move requestDevice to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-request-device
Patch Set: Remove debug log Created 4 years, 7 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/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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 HeapVector<Member<BluetoothRemoteGATTCharacteristic>> characteristics; 53 HeapVector<Member<BluetoothRemoteGATTCharacteristic>> characteristics;
54 characteristics.reserveInitialCapacity(webCharacteristics.size()); 54 characteristics.reserveInitialCapacity(webCharacteristics.size());
55 for (WebBluetoothRemoteGATTCharacteristicInit* webCharacteristic : webCh aracteristics) { 55 for (WebBluetoothRemoteGATTCharacteristicInit* webCharacteristic : webCh aracteristics) {
56 characteristics.append(BluetoothRemoteGATTCharacteristic::take(m_res olver, adoptPtr(webCharacteristic))); 56 characteristics.append(BluetoothRemoteGATTCharacteristic::take(m_res olver, adoptPtr(webCharacteristic)));
57 } 57 }
58 m_resolver->resolve(characteristics); 58 m_resolver->resolve(characteristics);
59 } 59 }
60 60
61 void onError(const WebBluetoothError& e) override 61 void onError(const mojom::WebBluetoothError& e) override
62 { 62 {
63 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped()) 63 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped())
64 return; 64 return;
65 m_resolver->reject(BluetoothError::take(m_resolver, e)); 65 m_resolver->reject(BluetoothError::take(m_resolver, e));
66 } 66 }
67 private: 67 private:
68 Persistent<ScriptPromiseResolver> m_resolver; 68 Persistent<ScriptPromiseResolver> m_resolver;
69 mojom::WebBluetoothGATTQueryQuantity m_quantity; 69 mojom::WebBluetoothGATTQueryQuantity m_quantity;
70 }; 70 };
71 71
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 111 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
112 ScriptPromise promise = resolver->promise(); 112 ScriptPromise promise = resolver->promise();
113 113
114 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e); 114 WebBluetooth* webbluetooth = BluetoothSupplement::fromScriptState(scriptStat e);
115 webbluetooth->getCharacteristics(m_webService->serviceInstanceID, quantity, characteristicsUUID, new GetCharacteristicsCallback(quantity, resolver)); 115 webbluetooth->getCharacteristics(m_webService->serviceInstanceID, quantity, characteristicsUUID, new GetCharacteristicsCallback(quantity, resolver));
116 116
117 return promise; 117 return promise;
118 } 118 }
119 119
120 } // namespace blink 120 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698