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

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

Issue 2394423002: bluetooth: Rename blink::mojom::WebBluetoothError (Closed)
Patch Set: bluetooth: Rename blink::mojom::WebBluetoothError Created 4 years, 2 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/BluetoothRemoteGATTServer.h" 5 #include "modules/bluetooth/BluetoothRemoteGATTServer.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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void onSuccess() override { 62 void onSuccess() override {
63 if (!m_resolver->getExecutionContext() || 63 if (!m_resolver->getExecutionContext() ||
64 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) 64 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
65 return; 65 return;
66 m_device->gatt()->setConnected(true); 66 m_device->gatt()->setConnected(true);
67 m_resolver->resolve(m_device->gatt()); 67 m_resolver->resolve(m_device->gatt());
68 } 68 }
69 69
70 void onError( 70 void onError(
71 int32_t 71 int32_t
72 error /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) 72 error /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */)
73 override { 73 override {
74 if (!m_resolver->getExecutionContext() || 74 if (!m_resolver->getExecutionContext() ||
75 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) 75 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
76 return; 76 return;
77 m_resolver->reject(BluetoothError::take(m_resolver, error)); 77 m_resolver->reject(BluetoothError::take(m_resolver, error));
78 } 78 }
79 79
80 private: 80 private:
81 Persistent<BluetoothDevice> m_device; 81 Persistent<BluetoothDevice> m_device;
82 Persistent<ScriptPromiseResolver> m_resolver; 82 Persistent<ScriptPromiseResolver> m_resolver;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 services.reserveInitialCapacity(webServices.size()); 149 services.reserveInitialCapacity(webServices.size());
150 for (WebBluetoothRemoteGATTService* webService : webServices) { 150 for (WebBluetoothRemoteGATTService* webService : webServices) {
151 services.append(BluetoothRemoteGATTService::take( 151 services.append(BluetoothRemoteGATTService::take(
152 m_resolver, wrapUnique(webService), m_device)); 152 m_resolver, wrapUnique(webService), m_device));
153 } 153 }
154 m_resolver->resolve(services); 154 m_resolver->resolve(services);
155 } 155 }
156 156
157 void onError( 157 void onError(
158 int32_t 158 int32_t
159 error /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) 159 error /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */)
160 override { 160 override {
161 if (!m_resolver->getExecutionContext() || 161 if (!m_resolver->getExecutionContext() ||
162 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) 162 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped())
163 return; 163 return;
164 164
165 m_device->gatt()->RemoveFromActiveAlgorithms(m_resolver.get()); 165 m_device->gatt()->RemoveFromActiveAlgorithms(m_resolver.get());
166 m_resolver->reject(BluetoothError::take(m_resolver, error)); 166 m_resolver->reject(BluetoothError::take(m_resolver, error));
167 } 167 }
168 168
169 private: 169 private:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 WebBluetooth* webbluetooth = 221 WebBluetooth* webbluetooth =
222 BluetoothSupplement::fromScriptState(scriptState); 222 BluetoothSupplement::fromScriptState(scriptState);
223 webbluetooth->getPrimaryServices( 223 webbluetooth->getPrimaryServices(
224 device()->id(), static_cast<int32_t>(quantity), servicesUUID, 224 device()->id(), static_cast<int32_t>(quantity), servicesUUID,
225 new GetPrimaryServicesCallback(device(), quantity, resolver)); 225 new GetPrimaryServicesCallback(device(), quantity, resolver));
226 226
227 return promise; 227 return promise;
228 } 228 }
229 229
230 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698