Keep auxilliary media objects on the heap always.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / html / HTMLTrackElement.h
blob4af6bfd69cbcceee28dbbff336f9c50ef2a50da3
1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef HTMLTrackElement_h
27 #define HTMLTrackElement_h
29 #include "core/html/HTMLElement.h"
30 #include "core/html/track/TextTrack.h"
31 #include "core/loader/TextTrackLoader.h"
32 #include "platform/heap/Handle.h"
34 namespace blink {
36 class HTMLMediaElement;
37 class LoadableTextTrack;
39 class HTMLTrackElement final : public HTMLElement, private TextTrackLoaderClient {
40 DEFINE_WRAPPERTYPEINFO();
41 public:
42 DECLARE_NODE_FACTORY(HTMLTrackElement);
44 const AtomicString& kind();
45 void setKind(const AtomicString&);
47 enum ReadyState {
48 NONE = 0,
49 LOADING = 1,
50 LOADED = 2,
51 TRACK_ERROR = 3
53 ReadyState readyState();
54 void scheduleLoad();
56 TextTrack* track();
58 DECLARE_VIRTUAL_TRACE();
60 private:
61 explicit HTMLTrackElement(Document&);
62 ~HTMLTrackElement() override;
64 void parseAttribute(const QualifiedName&, const AtomicString&) override;
66 InsertionNotificationRequest insertedInto(ContainerNode*) override;
68 void removedFrom(ContainerNode*) override;
69 bool isURLAttribute(const Attribute&) const override;
71 // TextTrackLoaderClient
72 void newCuesAvailable(TextTrackLoader*) override;
73 void cueLoadingCompleted(TextTrackLoader*, bool loadingFailed) override;
74 void newRegionsAvailable(TextTrackLoader*) override;
76 void setReadyState(ReadyState);
78 const AtomicString& mediaElementCrossOriginAttribute() const;
79 bool canLoadUrl(const KURL&);
80 void loadTimerFired(Timer<HTMLTrackElement>*);
82 enum LoadStatus {
83 Failure,
84 Success
86 void didCompleteLoad(LoadStatus);
88 HTMLMediaElement* mediaElement() const;
90 LoadableTextTrack* ensureTrack();
92 PersistentWillBeMember<LoadableTextTrack> m_track;
93 OwnPtrWillBeMember<TextTrackLoader> m_loader;
94 Timer<HTMLTrackElement> m_loadTimer;
95 KURL m_url;
98 } // namespace blink
100 #endif // HTMLTrackElement_h