OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/imagecapture/ImageCapture.h" | 5 #include "modules/imagecapture/ImageCapture.h" |
6 | 6 |
7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 241 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
242 ScriptPromise promise = resolver->promise(); | 242 ScriptPromise promise = resolver->promise(); |
243 | 243 |
244 if (trackIsInactive(*m_streamTrack)) { | 244 if (trackIsInactive(*m_streamTrack)) { |
245 resolver->reject(DOMException::create( | 245 resolver->reject(DOMException::create( |
246 InvalidStateError, "The associated Track is in an invalid state.")); | 246 InvalidStateError, "The associated Track is in an invalid state.")); |
247 return promise; | 247 return promise; |
248 } | 248 } |
249 | 249 |
250 // Create |m_frameGrabber| the first time. | 250 // Create |m_frameGrabber| the first time. |
251 if (!m_frameGrabber) | 251 if (!m_frameGrabber) { |
252 m_frameGrabber = | 252 m_frameGrabber = |
253 wrapUnique(Platform::current()->createImageCaptureFrameGrabber()); | 253 WTF::wrapUnique(Platform::current()->createImageCaptureFrameGrabber()); |
| 254 } |
254 | 255 |
255 if (!m_frameGrabber) { | 256 if (!m_frameGrabber) { |
256 resolver->reject(DOMException::create( | 257 resolver->reject(DOMException::create( |
257 UnknownError, "Couldn't create platform resources")); | 258 UnknownError, "Couldn't create platform resources")); |
258 return promise; | 259 return promise; |
259 } | 260 } |
260 | 261 |
261 // The platform does not know about MediaStreamTrack, so we wrap it up. | 262 // The platform does not know about MediaStreamTrack, so we wrap it up. |
262 WebMediaStreamTrack track(m_streamTrack->component()); | 263 WebMediaStreamTrack track(m_streamTrack->component()); |
263 m_frameGrabber->grabFrame( | 264 m_frameGrabber->grabFrame( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 383 } |
383 | 384 |
384 DEFINE_TRACE(ImageCapture) { | 385 DEFINE_TRACE(ImageCapture) { |
385 visitor->trace(m_streamTrack); | 386 visitor->trace(m_streamTrack); |
386 visitor->trace(m_serviceRequests); | 387 visitor->trace(m_serviceRequests); |
387 EventTargetWithInlineData::trace(visitor); | 388 EventTargetWithInlineData::trace(visitor); |
388 ContextLifecycleObserver::trace(visitor); | 389 ContextLifecycleObserver::trace(visitor); |
389 } | 390 } |
390 | 391 |
391 } // namespace blink | 392 } // namespace blink |
OLD | NEW |