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

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

Issue 2552993002: Rename activeDOMObjectsAreStopped to isContextDestroyed (Closed)
Patch Set: Created 4 years 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 CHECK(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()->activeDOMObjectsAreStopped()) 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
69 // disconnected so we reject. 69 // disconnected so we reject.
70 if (!m_service->device()->gatt()->RemoveFromActiveAlgorithms( 70 if (!m_service->device()->gatt()->RemoveFromActiveAlgorithms(
71 m_resolver.get())) { 71 m_resolver.get())) {
72 m_resolver->reject( 72 m_resolver->reject(
73 DOMException::create(NetworkError, kGATTServerDisconnected)); 73 DOMException::create(NetworkError, kGATTServerDisconnected));
74 return; 74 return;
75 } 75 }
(...skipping 17 matching lines...) Expand all
93 m_service)); 93 m_service));
94 } 94 }
95 m_resolver->resolve(characteristics); 95 m_resolver->resolve(characteristics);
96 } 96 }
97 97
98 void onError( 98 void onError(
99 int32_t 99 int32_t
100 error /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */) 100 error /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */)
101 override { 101 override {
102 if (!m_resolver->getExecutionContext() || 102 if (!m_resolver->getExecutionContext() ||
103 m_resolver->getExecutionContext()->activeDOMObjectsAreStopped()) 103 m_resolver->getExecutionContext()->isContextDestroyed())
104 return; 104 return;
105 105
106 // If the resolver is not in the set of ActiveAlgorithms then the frame 106 // If the resolver is not in the set of ActiveAlgorithms then the frame
107 // disconnected so we reject. 107 // disconnected so we reject.
108 if (!m_service->device()->gatt()->RemoveFromActiveAlgorithms( 108 if (!m_service->device()->gatt()->RemoveFromActiveAlgorithms(
109 m_resolver.get())) { 109 m_resolver.get())) {
110 m_resolver->reject( 110 m_resolver->reject(
111 DOMException::create(NetworkError, kGATTServerDisconnected)); 111 DOMException::create(NetworkError, kGATTServerDisconnected));
112 return; 112 return;
113 } 113 }
(...skipping 64 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