| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ImageCapture_h |
| 6 #define ImageCapture_h |
| 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "core/dom/ContextLifecycleObserver.h" |
| 11 #include "core/events/EventTarget.h" |
| 12 #include "modules/EventTargetModules.h" |
| 13 #include "modules/ModulesExport.h" |
| 14 #include "platform/AsyncMethodRunner.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class ExceptionState; |
| 19 class MediaStreamTrack; |
| 20 |
| 21 // TODO(mcasas): Consideradding a LayoutTest checking that this class is not |
| 22 // garbage collected while it has event listeners. |
| 23 class MODULES_EXPORT ImageCapture final |
| 24 : public EventTargetWithInlineData |
| 25 , public ActiveScriptWrappable |
| 26 , public ContextLifecycleObserver { |
| 27 USING_GARBAGE_COLLECTED_MIXIN(ImageCapture); |
| 28 DEFINE_WRAPPERTYPEINFO(); |
| 29 public: |
| 30 static ImageCapture* create(ExecutionContext*, MediaStreamTrack*, ExceptionS
tate&); |
| 31 ~ImageCapture() override; |
| 32 |
| 33 // EventTarget implementation. |
| 34 const AtomicString& interfaceName() const override; |
| 35 ExecutionContext* getExecutionContext() const override; |
| 36 |
| 37 // ActiveScriptWrappable implementation. |
| 38 bool hasPendingActivity() const final; |
| 39 |
| 40 // ContextLifecycleObserver |
| 41 void contextDestroyed() override; |
| 42 |
| 43 MediaStreamTrack* videoStreamTrack() const { return m_streamTrack.get(); } |
| 44 |
| 45 ScriptPromise grabFrame(ScriptState*, ExceptionState&); |
| 46 |
| 47 DECLARE_VIRTUAL_TRACE(); |
| 48 |
| 49 private: |
| 50 ImageCapture(ExecutionContext*, MediaStreamTrack*); |
| 51 |
| 52 // EventTarget implementation. |
| 53 bool addEventListenerInternal(const AtomicString& eventType, EventListener*,
const EventListenerOptions&) override; |
| 54 |
| 55 Member<MediaStreamTrack> m_streamTrack; |
| 56 }; |
| 57 |
| 58 } // namespace blink |
| 59 |
| 60 #endif // ImageCapture_h |
| OLD | NEW |