diff options
Diffstat (limited to 'Source/WebCore/Modules/mediasource/SourceBufferList.h')
-rw-r--r-- | Source/WebCore/Modules/mediasource/SourceBufferList.h | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/Source/WebCore/Modules/mediasource/SourceBufferList.h b/Source/WebCore/Modules/mediasource/SourceBufferList.h index fa237b385..fc47f05fe 100644 --- a/Source/WebCore/Modules/mediasource/SourceBufferList.h +++ b/Source/WebCore/Modules/mediasource/SourceBufferList.h @@ -28,8 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SourceBufferList_h -#define SourceBufferList_h +#pragma once #if ENABLE(MEDIA_SOURCE) @@ -43,28 +42,29 @@ namespace WebCore { class SourceBuffer; -class SourceBufferList final : public RefCounted<SourceBufferList>, public ScriptWrappable, public EventTargetWithInlineData { +class SourceBufferList final : public RefCounted<SourceBufferList>, public EventTargetWithInlineData { public: - static PassRefPtr<SourceBufferList> create(ScriptExecutionContext* context) + static Ref<SourceBufferList> create(ScriptExecutionContext* context) { - return adoptRef(new SourceBufferList(context)); + return adoptRef(*new SourceBufferList(context)); } virtual ~SourceBufferList(); unsigned long length() const { return m_list.size(); } - SourceBuffer* item(unsigned long index) const { return (index < m_list.size()) ? m_list[index].get() : 0; } + SourceBuffer* item(unsigned long index) const { return (index < m_list.size()) ? m_list[index].get() : nullptr; } - void add(PassRefPtr<SourceBuffer>); - void remove(SourceBuffer*); - bool contains(SourceBuffer* buffer) { return m_list.find(buffer) != notFound; } + void add(Ref<SourceBuffer>&&); + void remove(SourceBuffer&); + bool contains(SourceBuffer& buffer) { return m_list.find(&buffer) != notFound; } void clear(); + void swap(Vector<RefPtr<SourceBuffer>>&); Vector<RefPtr<SourceBuffer>>::iterator begin() { return m_list.begin(); } Vector<RefPtr<SourceBuffer>>::iterator end() { return m_list.end(); } // EventTarget interface - virtual EventTargetInterface eventTargetInterface() const override { return SourceBufferListEventTargetInterfaceType; } - virtual ScriptExecutionContext* scriptExecutionContext() const override { return m_scriptExecutionContext; } + EventTargetInterface eventTargetInterface() const override { return SourceBufferListEventTargetInterfaceType; } + ScriptExecutionContext* scriptExecutionContext() const override { return m_scriptExecutionContext; } using RefCounted<SourceBufferList>::ref; using RefCounted<SourceBufferList>::deref; @@ -74,8 +74,8 @@ private: void scheduleEvent(const AtomicString&); - virtual void refEventTarget() override { ref(); } - virtual void derefEventTarget() override { deref(); } + void refEventTarget() override { ref(); } + void derefEventTarget() override { deref(); } ScriptExecutionContext* m_scriptExecutionContext; GenericEventQueue m_asyncEventQueue; @@ -85,6 +85,4 @@ private: } // namespace WebCore -#endif - -#endif +#endif // ENABLE(MEDIA_SOURCE) |