diff options
Diffstat (limited to 'Source/WebCore/html/track/TextTrackCueList.h')
-rw-r--r-- | Source/WebCore/html/track/TextTrackCueList.h | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/Source/WebCore/html/track/TextTrackCueList.h b/Source/WebCore/html/track/TextTrackCueList.h index 8478fa31f..fe04c446d 100644 --- a/Source/WebCore/html/track/TextTrackCueList.h +++ b/Source/WebCore/html/track/TextTrackCueList.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2017 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,52 +24,47 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TextTrackCueList_h -#define TextTrackCueList_h +#pragma once #if ENABLE(VIDEO_TRACK) #include "TextTrackCue.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/Vector.h> namespace WebCore { class TextTrackCueList : public RefCounted<TextTrackCueList> { public: - static PassRefPtr<TextTrackCueList> create() - { - return adoptRef(new TextTrackCueList); - } - - ~TextTrackCueList() { } - - unsigned long length() const; - unsigned long getCueIndex(TextTrackCue*) const; + static Ref<TextTrackCueList> create(); + unsigned length() const; TextTrackCue* item(unsigned index) const; TextTrackCue* getCueById(const String&) const; - TextTrackCueList* activeCues(); - bool add(PassRefPtr<TextTrackCue>); - bool remove(TextTrackCue*); - bool contains(TextTrackCue*) const; - - bool updateCueIndex(TextTrackCue*); + unsigned cueIndex(TextTrackCue&) const; + + void add(Ref<TextTrackCue>&&); + void remove(TextTrackCue&); + void updateCueIndex(TextTrackCue&); + + TextTrackCueList& activeCues(); private: - TextTrackCueList(); - bool add(PassRefPtr<TextTrackCue>, size_t, size_t); - void clear(); - void invalidateCueIndexes(size_t); + TextTrackCueList() = default; - Vector<RefPtr<TextTrackCue>> m_list; + Vector<RefPtr<TextTrackCue>> m_vector; RefPtr<TextTrackCueList> m_activeCues; - }; +inline Ref<TextTrackCueList> TextTrackCueList::create() +{ + return adoptRef(*new TextTrackCueList); +} + +inline unsigned TextTrackCueList::length() const +{ + return m_vector.size(); +} + } // namespace WebCore -#endif -#endif +#endif // ENABLE(VIDEO_TRACK) |