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/USB.h" | 5 #include "modules/webusb/USB.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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 return EventTargetNames::USB; | 136 return EventTargetNames::USB; |
137 } | 137 } |
138 | 138 |
139 void USB::contextDestroyed() | 139 void USB::contextDestroyed() |
140 { | 140 { |
141 if (m_client) | 141 if (m_client) |
142 m_client->removeObserver(this); | 142 m_client->removeObserver(this); |
143 m_client = nullptr; | 143 m_client = nullptr; |
144 } | 144 } |
145 | 145 |
146 void USB::onDeviceConnected(WebPassOwnPtr<WebUSBDevice> device) | 146 void USB::onDeviceConnected(std::unique_ptr<WebUSBDevice> device) |
147 { | 147 { |
148 dispatchEvent(USBConnectionEvent::create(EventTypeNames::connect, USBDevice:
:create(device.release(), getExecutionContext()))); | 148 dispatchEvent(USBConnectionEvent::create(EventTypeNames::connect, USBDevice:
:create(adoptPtr(device.release()), getExecutionContext()))); |
149 } | 149 } |
150 | 150 |
151 void USB::onDeviceDisconnected(WebPassOwnPtr<WebUSBDevice> device) | 151 void USB::onDeviceDisconnected(std::unique_ptr<WebUSBDevice> device) |
152 { | 152 { |
153 dispatchEvent(USBConnectionEvent::create(EventTypeNames::disconnect, USBDevi
ce::create(device.release(), getExecutionContext()))); | 153 dispatchEvent(USBConnectionEvent::create(EventTypeNames::disconnect, USBDevi
ce::create(adoptPtr(device.release()), getExecutionContext()))); |
154 } | 154 } |
155 | 155 |
156 DEFINE_TRACE(USB) | 156 DEFINE_TRACE(USB) |
157 { | 157 { |
158 RefCountedGarbageCollectedEventTargetWithInlineData<USB>::trace(visitor); | 158 RefCountedGarbageCollectedEventTargetWithInlineData<USB>::trace(visitor); |
159 ContextLifecycleObserver::trace(visitor); | 159 ContextLifecycleObserver::trace(visitor); |
160 } | 160 } |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
OLD | NEW |