| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef TextTrackLoader_h | 26 #ifndef TextTrackLoader_h |
| 27 #define TextTrackLoader_h | 27 #define TextTrackLoader_h |
| 28 | 28 |
| 29 #include "core/fetch/RawResource.h" | 29 #include "core/fetch/RawResource.h" |
| 30 #include "core/fetch/ResourceOwner.h" | 30 #include "core/fetch/ResourceOwner.h" |
| 31 #include "core/html/track/vtt/VTTParser.h" | 31 #include "core/html/track/vtt/VTTParser.h" |
| 32 #include "platform/CrossOriginAttributeValue.h" |
| 32 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 33 #include "platform/heap/Handle.h" | 34 #include "platform/heap/Handle.h" |
| 34 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 35 | 36 |
| 36 namespace blink { | 37 namespace blink { |
| 37 | 38 |
| 38 class Document; | 39 class Document; |
| 39 class TextTrackLoader; | 40 class TextTrackLoader; |
| 40 | 41 |
| 41 class TextTrackLoaderClient { | 42 class TextTrackLoaderClient { |
| 42 public: | 43 public: |
| 43 virtual ~TextTrackLoaderClient() {} | 44 virtual ~TextTrackLoaderClient() {} |
| 44 | 45 |
| 45 virtual void newCuesAvailable(TextTrackLoader*) = 0; | 46 virtual void newCuesAvailable(TextTrackLoader*) = 0; |
| 46 virtual void cueLoadingCompleted(TextTrackLoader*, bool loadingFailed) = 0; | 47 virtual void cueLoadingCompleted(TextTrackLoader*, bool loadingFailed) = 0; |
| 47 virtual void newRegionsAvailable(TextTrackLoader*) = 0; | 48 virtual void newRegionsAvailable(TextTrackLoader*) = 0; |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 class TextTrackLoader final : public NoBaseWillBeGarbageCollectedFinalized<TextT
rackLoader>, public ResourceOwner<RawResource>, private VTTParserClient { | 51 class TextTrackLoader final : public NoBaseWillBeGarbageCollectedFinalized<TextT
rackLoader>, public ResourceOwner<RawResource>, private VTTParserClient { |
| 51 WTF_MAKE_NONCOPYABLE(TextTrackLoader); | 52 WTF_MAKE_NONCOPYABLE(TextTrackLoader); |
| 52 USING_FAST_MALLOC_WILL_BE_REMOVED(TextTrackLoader); | 53 USING_FAST_MALLOC_WILL_BE_REMOVED(TextTrackLoader); |
| 53 public: | 54 public: |
| 54 static PassOwnPtrWillBeRawPtr<TextTrackLoader> create(TextTrackLoaderClient&
client, Document& document) | 55 static PassOwnPtrWillBeRawPtr<TextTrackLoader> create(TextTrackLoaderClient&
client, Document& document) |
| 55 { | 56 { |
| 56 return adoptPtrWillBeNoop(new TextTrackLoader(client, document)); | 57 return adoptPtrWillBeNoop(new TextTrackLoader(client, document)); |
| 57 } | 58 } |
| 58 ~TextTrackLoader() override; | 59 ~TextTrackLoader() override; |
| 59 | 60 |
| 60 bool load(const KURL&, const AtomicString& crossOriginMode); | 61 bool load(const KURL&, CrossOriginAttributeValue); |
| 61 void cancelLoad(); | 62 void cancelLoad(); |
| 62 | 63 |
| 63 enum State { Idle, Loading, Finished, Failed }; | 64 enum State { Idle, Loading, Finished, Failed }; |
| 64 State loadState() { return m_state; } | 65 State loadState() { return m_state; } |
| 65 | 66 |
| 66 void getNewCues(HeapVector<Member<TextTrackCue>>& outputCues); | 67 void getNewCues(HeapVector<Member<TextTrackCue>>& outputCues); |
| 67 void getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions); | 68 void getNewRegions(HeapVector<Member<VTTRegion>>& outputRegions); |
| 68 | 69 |
| 69 DECLARE_TRACE(); | 70 DECLARE_TRACE(); |
| 70 | 71 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 91 // FIXME: Remove this pointer and get the Document from m_client. | 92 // FIXME: Remove this pointer and get the Document from m_client. |
| 92 RawPtrWillBeMember<Document> m_document; | 93 RawPtrWillBeMember<Document> m_document; |
| 93 Timer<TextTrackLoader> m_cueLoadTimer; | 94 Timer<TextTrackLoader> m_cueLoadTimer; |
| 94 State m_state; | 95 State m_state; |
| 95 bool m_newCuesAvailable; | 96 bool m_newCuesAvailable; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 } // namespace blink | 99 } // namespace blink |
| 99 | 100 |
| 100 #endif | 101 #endif |
| OLD | NEW |