OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/dom/EventTarget.h" | 35 #include "core/dom/EventTarget.h" |
36 #include "core/html/HTMLMediaSource.h" | 36 #include "core/html/HTMLMediaSource.h" |
37 #include "core/html/URLRegistry.h" | 37 #include "core/html/URLRegistry.h" |
38 #include "core/platform/graphics/MediaSourcePrivate.h" | 38 #include "core/platform/graphics/MediaSourcePrivate.h" |
39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 class ExceptionState; | |
46 class GenericEventQueue; | 45 class GenericEventQueue; |
47 | 46 |
48 class MediaSourceBase : public RefCounted<MediaSourceBase>, public HTMLMediaSour
ce, public ActiveDOMObject, public EventTarget { | 47 class MediaSourceBase : public RefCounted<MediaSourceBase>, public HTMLMediaSour
ce, public ActiveDOMObject, public EventTarget { |
49 public: | 48 public: |
50 static const AtomicString& openKeyword(); | 49 static const AtomicString& openKeyword(); |
51 static const AtomicString& closedKeyword(); | 50 static const AtomicString& closedKeyword(); |
52 static const AtomicString& endedKeyword(); | 51 static const AtomicString& endedKeyword(); |
53 | 52 |
54 virtual ~MediaSourceBase(); | 53 virtual ~MediaSourceBase(); |
55 | 54 |
56 void addedToRegistry(); | 55 void addedToRegistry(); |
57 void removedFromRegistry(); | 56 void removedFromRegistry(); |
58 void openIfInEndedState(); | 57 void openIfInEndedState(); |
59 bool isOpen() const; | 58 bool isOpen() const; |
60 | 59 |
61 // HTMLMediaSource | 60 // HTMLMediaSource |
62 virtual bool attachToElement() OVERRIDE; | 61 virtual bool attachToElement() OVERRIDE; |
63 virtual void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>) OVERRIDE; | 62 virtual void setPrivateAndOpen(PassOwnPtr<MediaSourcePrivate>) OVERRIDE; |
64 virtual void close() OVERRIDE; | 63 virtual void close() OVERRIDE; |
65 virtual bool isClosed() const OVERRIDE; | 64 virtual bool isClosed() const OVERRIDE; |
66 virtual double duration() const OVERRIDE; | 65 virtual double duration() const OVERRIDE; |
67 virtual PassRefPtr<TimeRanges> buffered() const OVERRIDE; | 66 virtual PassRefPtr<TimeRanges> buffered() const OVERRIDE; |
68 virtual void refHTMLMediaSource() OVERRIDE { ref(); } | 67 virtual void refHTMLMediaSource() OVERRIDE { ref(); } |
69 virtual void derefHTMLMediaSource() OVERRIDE { deref(); } | 68 virtual void derefHTMLMediaSource() OVERRIDE { deref(); } |
70 | 69 |
71 void setDuration(double, ExceptionState&); | 70 void setDuration(double, ExceptionCode&); |
72 const AtomicString& readyState() const { return m_readyState; } | 71 const AtomicString& readyState() const { return m_readyState; } |
73 void setReadyState(const AtomicString&); | 72 void setReadyState(const AtomicString&); |
74 void endOfStream(const AtomicString& error, ExceptionState&); | 73 void endOfStream(const AtomicString& error, ExceptionCode&); |
75 | 74 |
76 | 75 |
77 // ActiveDOMObject interface | 76 // ActiveDOMObject interface |
78 virtual bool hasPendingActivity() const OVERRIDE; | 77 virtual bool hasPendingActivity() const OVERRIDE; |
79 virtual void stop() OVERRIDE; | 78 virtual void stop() OVERRIDE; |
80 | 79 |
81 // EventTarget interface | 80 // EventTarget interface |
82 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; | 81 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
83 virtual EventTargetData* eventTargetData() OVERRIDE; | 82 virtual EventTargetData* eventTargetData() OVERRIDE; |
84 virtual EventTargetData* ensureEventTargetData() OVERRIDE; | 83 virtual EventTargetData* ensureEventTargetData() OVERRIDE; |
85 virtual void refEventTarget() OVERRIDE { ref(); } | 84 virtual void refEventTarget() OVERRIDE { ref(); } |
86 virtual void derefEventTarget() OVERRIDE { deref(); } | 85 virtual void derefEventTarget() OVERRIDE { deref(); } |
87 | 86 |
88 // URLRegistrable interface | 87 // URLRegistrable interface |
89 virtual URLRegistry& registry() const OVERRIDE; | 88 virtual URLRegistry& registry() const OVERRIDE; |
90 | 89 |
91 using RefCounted<MediaSourceBase>::ref; | 90 using RefCounted<MediaSourceBase>::ref; |
92 using RefCounted<MediaSourceBase>::deref; | 91 using RefCounted<MediaSourceBase>::deref; |
93 | 92 |
94 protected: | 93 protected: |
95 explicit MediaSourceBase(ScriptExecutionContext*); | 94 explicit MediaSourceBase(ScriptExecutionContext*); |
96 | 95 |
97 virtual void onReadyStateChange(const AtomicString& oldState, const AtomicSt
ring& newState) = 0; | 96 virtual void onReadyStateChange(const AtomicString& oldState, const AtomicSt
ring& newState) = 0; |
98 virtual Vector<RefPtr<TimeRanges> > activeRanges() const = 0; | 97 virtual Vector<RefPtr<TimeRanges> > activeRanges() const = 0; |
99 | 98 |
100 PassOwnPtr<SourceBufferPrivate> createSourceBufferPrivate(const String& type
, const MediaSourcePrivate::CodecsArray&, ExceptionState&); | 99 PassOwnPtr<SourceBufferPrivate> createSourceBufferPrivate(const String& type
, const MediaSourcePrivate::CodecsArray&, ExceptionCode&); |
101 void scheduleEvent(const AtomicString& eventName); | 100 void scheduleEvent(const AtomicString& eventName); |
102 GenericEventQueue* asyncEventQueue() const { return m_asyncEventQueue.get();
} | 101 GenericEventQueue* asyncEventQueue() const { return m_asyncEventQueue.get();
} |
103 | 102 |
104 private: | 103 private: |
105 OwnPtr<MediaSourcePrivate> m_private; | 104 OwnPtr<MediaSourcePrivate> m_private; |
106 EventTargetData m_eventTargetData; | 105 EventTargetData m_eventTargetData; |
107 AtomicString m_readyState; | 106 AtomicString m_readyState; |
108 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 107 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
109 bool m_attached; | 108 bool m_attached; |
110 }; | 109 }; |
111 | 110 |
112 } | 111 } |
113 | 112 |
114 #endif | 113 #endif |
OLD | NEW |