| OLD | NEW |
| 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/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 "bindings/core/v8/ToV8.h" | 9 #include "bindings/core/v8/ToV8.h" |
| 10 #include "core/dom/DOMArrayBuffer.h" | 10 #include "core/dom/DOMArrayBuffer.h" |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 } else { | 494 } else { |
| 495 m_deviceRequests.add(resolver); | 495 m_deviceRequests.add(resolver); |
| 496 m_device->Reset(convertToBaseCallback( | 496 m_device->Reset(convertToBaseCallback( |
| 497 WTF::bind(&USBDevice::asyncReset, wrapPersistent(this), | 497 WTF::bind(&USBDevice::asyncReset, wrapPersistent(this), |
| 498 wrapPersistent(resolver)))); | 498 wrapPersistent(resolver)))); |
| 499 } | 499 } |
| 500 } | 500 } |
| 501 return promise; | 501 return promise; |
| 502 } | 502 } |
| 503 | 503 |
| 504 void USBDevice::contextDestroyed() { | 504 void USBDevice::contextDestroyed(ExecutionContext*) { |
| 505 m_device.reset(); | 505 m_device.reset(); |
| 506 m_deviceRequests.clear(); | 506 m_deviceRequests.clear(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 DEFINE_TRACE(USBDevice) { | 509 DEFINE_TRACE(USBDevice) { |
| 510 visitor->trace(m_deviceRequests); | 510 visitor->trace(m_deviceRequests); |
| 511 ContextLifecycleObserver::trace(visitor); | 511 ContextLifecycleObserver::trace(visitor); |
| 512 } | 512 } |
| 513 | 513 |
| 514 int USBDevice::findConfigurationIndex(uint8_t configurationValue) const { | 514 int USBDevice::findConfigurationIndex(uint8_t configurationValue) const { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 | 959 |
| 960 bool USBDevice::markRequestComplete(ScriptPromiseResolver* resolver) { | 960 bool USBDevice::markRequestComplete(ScriptPromiseResolver* resolver) { |
| 961 auto requestEntry = m_deviceRequests.find(resolver); | 961 auto requestEntry = m_deviceRequests.find(resolver); |
| 962 if (requestEntry == m_deviceRequests.end()) | 962 if (requestEntry == m_deviceRequests.end()) |
| 963 return false; | 963 return false; |
| 964 m_deviceRequests.remove(requestEntry); | 964 m_deviceRequests.remove(requestEntry); |
| 965 return true; | 965 return true; |
| 966 } | 966 } |
| 967 | 967 |
| 968 } // namespace blink | 968 } // namespace blink |
| OLD | NEW |