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

Side by Side Diff: third_party/WebKit/Source/modules/webusb/USBDevice.cpp

Issue 1773813007: blink: Rename modules/ method to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-modules: rebase-fixes Created 4 years, 9 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/webusb/USBDevice.h" 5 #include "modules/webusb/USBDevice.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 "bindings/core/v8/ToV8.h" 10 #include "bindings/core/v8/ToV8.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return ""; 73 return "";
74 } 74 }
75 } 75 }
76 76
77 class GetConfigurationPromiseAdapter : public WebCallbacks<uint8_t, const WebUSB Error&> { 77 class GetConfigurationPromiseAdapter : public WebCallbacks<uint8_t, const WebUSB Error&> {
78 public: 78 public:
79 GetConfigurationPromiseAdapter(USBDevice* device, ScriptPromiseResolver* res olver) : m_device(device), m_resolver(resolver) {} 79 GetConfigurationPromiseAdapter(USBDevice* device, ScriptPromiseResolver* res olver) : m_device(device), m_resolver(resolver) {}
80 80
81 void onSuccess(uint8_t value) override 81 void onSuccess(uint8_t value) override
82 { 82 {
83 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped()) 83 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped())
84 return; 84 return;
85 m_resolver->resolve(USBConfiguration::createFromValue(m_device, value)); 85 m_resolver->resolve(USBConfiguration::createFromValue(m_device, value));
86 } 86 }
87 87
88 void onError(const WebUSBError& e) override 88 void onError(const WebUSBError& e) override
89 { 89 {
90 if (!m_resolver->executionContext() || m_resolver->executionContext()->a ctiveDOMObjectsAreStopped()) 90 if (!m_resolver->getExecutionContext() || m_resolver->getExecutionContex t()->activeDOMObjectsAreStopped())
91 return; 91 return;
92 m_resolver->reject(USBError::take(m_resolver, e)); 92 m_resolver->reject(USBError::take(m_resolver, e));
93 } 93 }
94 94
95 private: 95 private:
96 Persistent<USBDevice> m_device; 96 Persistent<USBDevice> m_device;
97 Persistent<ScriptPromiseResolver> m_resolver; 97 Persistent<ScriptPromiseResolver> m_resolver;
98 }; 98 };
99 99
100 class InputTransferResult { 100 class InputTransferResult {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 for (size_t i = 0; i < info().configurations.size(); ++i) 198 for (size_t i = 0; i < info().configurations.size(); ++i)
199 configurations.append(USBConfiguration::create(this, i)); 199 configurations.append(USBConfiguration::create(this, i));
200 return configurations; 200 return configurations;
201 } 201 }
202 202
203 ScriptPromise USBDevice::open(ScriptState* scriptState) 203 ScriptPromise USBDevice::open(ScriptState* scriptState)
204 { 204 {
205 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 205 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
206 ScriptPromise promise = resolver->promise(); 206 ScriptPromise promise = resolver->promise();
207 m_device->open(new CallbackPromiseAdapter<void, USBError>(resolver)); 207 m_device->open(new CallbackPromiseAdapter<void, USBError>(resolver));
208 setContext(scriptState->executionContext()); 208 setContext(scriptState->getExecutionContext());
209 return promise; 209 return promise;
210 } 210 }
211 211
212 ScriptPromise USBDevice::close(ScriptState* scriptState) 212 ScriptPromise USBDevice::close(ScriptState* scriptState)
213 { 213 {
214 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ; 214 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState) ;
215 ScriptPromise promise = resolver->promise(); 215 ScriptPromise promise = resolver->promise();
216 m_device->close(new CallbackPromiseAdapter<void, USBError>(resolver)); 216 m_device->close(new CallbackPromiseAdapter<void, USBError>(resolver));
217 setContext(nullptr); 217 setContext(nullptr);
218 return promise; 218 return promise;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 { 353 {
354 m_device->close(new WebUSBDeviceCloseCallbacks()); 354 m_device->close(new WebUSBDeviceCloseCallbacks());
355 } 355 }
356 356
357 DEFINE_TRACE(USBDevice) 357 DEFINE_TRACE(USBDevice)
358 { 358 {
359 ContextLifecycleObserver::trace(visitor); 359 ContextLifecycleObserver::trace(visitor);
360 } 360 }
361 361
362 } // namespace blink 362 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webusb/USB.cpp ('k') | third_party/WebKit/Source/modules/worklet/Worklet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698