| 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 #ifndef MediaRecorder_h | 5 #ifndef MediaRecorder_h |
| 6 #define MediaRecorder_h | 6 #define MediaRecorder_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
| 9 #include "core/dom/ActiveDOMObject.h" | 9 #include "core/dom/SuspendableObject.h" |
| 10 #include "core/events/EventTarget.h" | 10 #include "core/events/EventTarget.h" |
| 11 #include "modules/EventTargetModules.h" | 11 #include "modules/EventTargetModules.h" |
| 12 #include "modules/ModulesExport.h" | 12 #include "modules/ModulesExport.h" |
| 13 #include "modules/mediarecorder/MediaRecorderOptions.h" | 13 #include "modules/mediarecorder/MediaRecorderOptions.h" |
| 14 #include "modules/mediastream/MediaStream.h" | 14 #include "modules/mediastream/MediaStream.h" |
| 15 #include "platform/AsyncMethodRunner.h" | 15 #include "platform/AsyncMethodRunner.h" |
| 16 #include "public/platform/WebMediaRecorderHandler.h" | 16 #include "public/platform/WebMediaRecorderHandler.h" |
| 17 #include "public/platform/WebMediaRecorderHandlerClient.h" | 17 #include "public/platform/WebMediaRecorderHandlerClient.h" |
| 18 #include <memory> | 18 #include <memory> |
| 19 | 19 |
| 20 namespace blink { | 20 namespace blink { |
| 21 | 21 |
| 22 class Blob; | 22 class Blob; |
| 23 class BlobData; | 23 class BlobData; |
| 24 class ExceptionState; | 24 class ExceptionState; |
| 25 | 25 |
| 26 class MODULES_EXPORT MediaRecorder final : public EventTargetWithInlineData, | 26 class MODULES_EXPORT MediaRecorder final : public EventTargetWithInlineData, |
| 27 public WebMediaRecorderHandlerClient, | 27 public WebMediaRecorderHandlerClient, |
| 28 public ActiveScriptWrappable, | 28 public ActiveScriptWrappable, |
| 29 public ActiveDOMObject { | 29 public SuspendableObject { |
| 30 USING_GARBAGE_COLLECTED_MIXIN(MediaRecorder); | 30 USING_GARBAGE_COLLECTED_MIXIN(MediaRecorder); |
| 31 DEFINE_WRAPPERTYPEINFO(); | 31 DEFINE_WRAPPERTYPEINFO(); |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 enum class State { Inactive = 0, Recording, Paused }; | 34 enum class State { Inactive = 0, Recording, Paused }; |
| 35 | 35 |
| 36 static MediaRecorder* create(ExecutionContext*, | 36 static MediaRecorder* create(ExecutionContext*, |
| 37 MediaStream*, | 37 MediaStream*, |
| 38 ExceptionState&); | 38 ExceptionState&); |
| 39 static MediaRecorder* create(ExecutionContext*, | 39 static MediaRecorder* create(ExecutionContext*, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 66 void pause(ExceptionState&); | 66 void pause(ExceptionState&); |
| 67 void resume(ExceptionState&); | 67 void resume(ExceptionState&); |
| 68 void requestData(ExceptionState&); | 68 void requestData(ExceptionState&); |
| 69 | 69 |
| 70 static bool isTypeSupported(const String& type); | 70 static bool isTypeSupported(const String& type); |
| 71 | 71 |
| 72 // EventTarget | 72 // EventTarget |
| 73 const AtomicString& interfaceName() const override; | 73 const AtomicString& interfaceName() const override; |
| 74 ExecutionContext* getExecutionContext() const override; | 74 ExecutionContext* getExecutionContext() const override; |
| 75 | 75 |
| 76 // ActiveDOMObject | 76 // SuspendableObject |
| 77 void suspend() override; | 77 void suspend() override; |
| 78 void resume() override; | 78 void resume() override; |
| 79 void contextDestroyed() override; | 79 void contextDestroyed() override; |
| 80 | 80 |
| 81 // ScriptWrappable | 81 // ScriptWrappable |
| 82 bool hasPendingActivity() const final { return !m_stopped; } | 82 bool hasPendingActivity() const final { return !m_stopped; } |
| 83 | 83 |
| 84 // WebMediaRecorderHandlerClient | 84 // WebMediaRecorderHandlerClient |
| 85 void writeData(const char* data, size_t length, bool lastInSlice) override; | 85 void writeData(const char* data, size_t length, bool lastInSlice) override; |
| 86 void onError(const WebString& message) override; | 86 void onError(const WebString& message) override; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 113 | 113 |
| 114 std::unique_ptr<WebMediaRecorderHandler> m_recorderHandler; | 114 std::unique_ptr<WebMediaRecorderHandler> m_recorderHandler; |
| 115 | 115 |
| 116 Member<AsyncMethodRunner<MediaRecorder>> m_dispatchScheduledEventRunner; | 116 Member<AsyncMethodRunner<MediaRecorder>> m_dispatchScheduledEventRunner; |
| 117 HeapVector<Member<Event>> m_scheduledEvents; | 117 HeapVector<Member<Event>> m_scheduledEvents; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace blink | 120 } // namespace blink |
| 121 | 121 |
| 122 #endif // MediaRecorder_h | 122 #endif // MediaRecorder_h |
| OLD | NEW |