Changeset 126946 in webkit
- Timestamp:
- Aug 28, 2012, 6:07:56 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/media/media-source/video-media-source-async-events-expected.txt (added)
-
LayoutTests/http/tests/media/media-source/video-media-source-async-events.html (added)
-
LayoutTests/http/tests/media/media-source/video-media-source-event-attributes.html (modified) (1 diff)
-
LayoutTests/http/tests/media/media-source/video-media-source-objects.html (modified) (5 diffs)
-
LayoutTests/http/tests/media/media-source/video-media-source-seek-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/media/media-source/video-media-source-state-changes-expected.txt (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Modules/mediasource/MediaSource.cpp (modified) (4 diffs)
-
Source/WebCore/Modules/mediasource/MediaSource.h (modified) (4 diffs)
-
Source/WebCore/Modules/mediasource/SourceBufferList.cpp (modified) (3 diffs)
-
Source/WebCore/Modules/mediasource/SourceBufferList.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r126944 r126946 1 2012-08-28 Aaron Colwell <acolwell@chromium.org> 2 3 Make MediaSource event dispatch asynchronous. 4 https://bugs.webkit.org/show_bug.cgi?id=95217 5 6 Reviewed by Eric Carlson. 7 8 - Added a test to verify that MediaSource & SourceBufferList events are dispatched asynchronously. 9 - Updated a few existing tests that were relying on the old synchronous dispatch. 10 11 * http/tests/media/media-source/video-media-source-async-events-expected.txt: Added. 12 * http/tests/media/media-source/video-media-source-async-events.html: Added. 13 * http/tests/media/media-source/video-media-source-event-attributes.html: 14 * http/tests/media/media-source/video-media-source-objects.html: 15 * http/tests/media/media-source/video-media-source-seek-expected.txt: 16 * http/tests/media/media-source/video-media-source-state-changes-expected.txt: 17 1 18 2012-08-28 Julien Chaffraix <jchaffraix@webkit.org> 2 19 -
trunk/LayoutTests/http/tests/media/media-source/video-media-source-event-attributes.html
r125059 r126946 20 20 consoleWrite("Setting src attribute to \"\" to trigger a webkitsourceclosed event."); 21 21 video.src = ""; 22 endTest();23 22 } 24 23 -
trunk/LayoutTests/http/tests/media/media-source/video-media-source-objects.html
r125682 r126946 22 22 23 23 run("segmentHelper.addSourceBuffer()"); 24 } 24 25 26 function afterSourceBufferAdded() 27 { 25 28 consoleWrite(""); 26 29 consoleWrite("Test SourceBuffer object type"); … … 65 68 66 69 run("mediaSource.removeSourceBuffer(segmentHelper.sourceBuffer)"); 70 } 67 71 72 function afterSourceBufferRemoved() 73 { 68 74 consoleWrite("Test that addSourceBuffer() throws and error when the MediaSource is not associated with a media element."); 69 75 var mediaSource2 = new MediaSource(); … … 84 90 endTest(); 85 91 } 86 92 87 93 function onSourceBufferAdded(event) 88 94 { … … 93 99 testExpected("mediaSource.sourceBuffers", event.target); 94 100 testExpected("mediaSource.sourceBuffers instanceof window.SourceBufferList", true); 101 102 afterSourceBufferAdded(); 95 103 } 96 104 … … 115 123 } 116 124 testExpected("mediaSource.sourceBuffers.length", 0); 125 126 afterSourceBufferRemoved(); 117 127 } 118 128 -
trunk/LayoutTests/http/tests/media/media-source/video-media-source-seek-expected.txt
r125059 r126946 5 5 EVENT(playing) 6 6 EVENT(timeupdate) : seeking to 2.78 7 EVENT(seeking) 7 8 EVENT(webkitsourceopen) 8 EVENT(seeking)9 9 EVENT(webkitsourceended) 10 10 EVENT(playing) -
trunk/LayoutTests/http/tests/media/media-source/video-media-source-state-changes-expected.txt
r125059 r126946 17 17 EVENT(seeked) 18 18 onSecondSeeked 19 EVENT(emptied) 19 20 EVENT(webkitsourceclose) : closed 20 21 onFirstSourceClose 21 EVENT(emptied)22 22 EVENT(webkitsourceopen) : open 23 23 onSecondSourceOpen … … 26 26 EVENT(playing) 27 27 triggerSecondSourceClose 28 EVENT(emptied) 28 29 EVENT(webkitsourceclose) : closed 29 30 onSecondSourceClose 30 EVENT(emptied)31 31 EVENT(webkitsourceopen) : open 32 32 onThirdSourceOpen -
trunk/Source/WebCore/ChangeLog
r126945 r126946 1 2012-08-28 Aaron Colwell <acolwell@chromium.org> 2 3 Make MediaSource event dispatch asynchronous. 4 https://bugs.webkit.org/show_bug.cgi?id=95217 5 6 Reviewed by Eric Carlson. 7 8 Update MediaSource & SourceBufferList to use a GenericEventQueue to dispatch events 9 instead of using synchronous dispatch. 10 11 Test: http/tests/media/media-source/video-media-source-async-events.html 12 13 * Modules/mediasource/MediaSource.cpp: 14 (WebCore::MediaSource::MediaSource): Create GenericEventQueue & pass a pointer to SourceBufferList. 15 (WebCore::MediaSource::addSourceBuffer): 16 (WebCore::MediaSource::setReadyState): Updated to use new scheduleEvent() helper method. 17 (WebCore::MediaSource::scheduleEvent): New method for creating events and adding them to the event queue. 18 (WebCore): 19 * Modules/mediasource/MediaSource.h: Added GenericEventQueue member and scheduleEvent() signature. 20 (MediaSource): 21 * Modules/mediasource/SourceBufferList.cpp: 22 (WebCore::SourceBufferList::SourceBufferList): 23 (WebCore::SourceBufferList::remove): 24 (WebCore::SourceBufferList::createAndFireEvent): Updated to queue events instead of synchronously dispatch them. 25 * Modules/mediasource/SourceBufferList.h: 26 (WebCore): 27 (WebCore::SourceBufferList::create): 28 (SourceBufferList): 29 1 30 2012-08-28 Leandro Gracia Gil <leandrogracia@chromium.org> 2 31 -
trunk/Source/WebCore/Modules/mediasource/MediaSource.cpp
r125682 r126946 50 50 , m_readyState(closedKeyword()) 51 51 , m_player(0) 52 { 53 m_sourceBuffers = SourceBufferList::create(scriptExecutionContext()); 54 m_activeSourceBuffers = SourceBufferList::create(scriptExecutionContext()); 52 , m_asyncEventQueue(GenericEventQueue::create(this)) 53 { 54 m_sourceBuffers = SourceBufferList::create(scriptExecutionContext(), m_asyncEventQueue.get()); 55 m_activeSourceBuffers = SourceBufferList::create(scriptExecutionContext(), m_asyncEventQueue.get()); 55 56 } 56 57 … … 85 86 return 0; 86 87 } 87 88 88 89 // 4. If the readyState attribute is not in the "open" state then throw an 89 90 // INVALID_STATE_ERR exception and abort these steps. … … 183 184 m_activeSourceBuffers->clear(); 184 185 m_player = 0; 185 dispatchEvent(Event::create(eventNames().webkitsourcecloseEvent, false, false));186 return; 187 } 188 186 scheduleEvent(eventNames().webkitsourcecloseEvent); 187 return; 188 } 189 189 190 if (oldState == openKeyword() && m_readyState == endedKeyword()) { 190 dispatchEvent(Event::create(eventNames().webkitsourceendedEvent, false, false));191 scheduleEvent(eventNames().webkitsourceendedEvent); 191 192 return; 192 193 } 193 194 194 195 if (m_readyState == openKeyword()) { 195 dispatchEvent(Event::create(eventNames().webkitsourceopenEvent, false, false));196 scheduleEvent(eventNames().webkitsourceopenEvent); 196 197 return; 197 198 } … … 302 303 } 303 304 305 void MediaSource::scheduleEvent(const AtomicString& eventName) 306 { 307 ASSERT(m_asyncEventQueue); 308 309 RefPtr<Event> event = Event::create(eventName, false, false); 310 event->setTarget(this); 311 312 m_asyncEventQueue->enqueueEvent(event.release()); 313 } 314 304 315 } // namespace WebCore 305 316 -
trunk/Source/WebCore/Modules/mediasource/MediaSource.h
r125682 r126946 35 35 36 36 #include "ContextDestructionObserver.h" 37 #include "GenericEventQueue.h" 37 38 #include "MediaPlayer.h" 38 39 #include "SourceBuffer.h" … … 77 78 78 79 void setMediaPlayer(MediaPlayer* player) { m_player = player; } 79 80 80 81 PassRefPtr<TimeRanges> buffered(const String& id, ExceptionCode&) const; 81 82 void append(const String& id, PassRefPtr<Uint8Array> data, ExceptionCode&); … … 99 100 virtual void derefEventTarget() OVERRIDE { deref(); } 100 101 102 void scheduleEvent(const AtomicString& eventName); 103 101 104 EventTargetData m_eventTargetData; 102 105 … … 106 109 RefPtr<SourceBufferList> m_sourceBuffers; 107 110 RefPtr<SourceBufferList> m_activeSourceBuffers; 111 OwnPtr<GenericEventQueue> m_asyncEventQueue; 108 112 }; 109 113 -
trunk/Source/WebCore/Modules/mediasource/SourceBufferList.cpp
r125424 r126946 39 39 namespace WebCore { 40 40 41 SourceBufferList::SourceBufferList(ScriptExecutionContext* context) 41 SourceBufferList::SourceBufferList(ScriptExecutionContext* context, 42 GenericEventQueue* asyncEventQueue) 42 43 : m_scriptExecutionContext(context) 44 , m_asyncEventQueue(asyncEventQueue) 43 45 , m_lastSourceBufferId(0) 44 46 { … … 64 66 65 67 bool SourceBufferList::remove(SourceBuffer* buffer) 66 { 68 { 67 69 size_t index = m_list.find(buffer); 68 70 if (index == notFound) … … 111 113 void SourceBufferList::createAndFireEvent(const AtomicString& eventName) 112 114 { 115 ASSERT(m_asyncEventQueue); 116 113 117 RefPtr<Event> event = Event::create(eventName, false, false); 114 118 event->setTarget(this); 115 119 116 EventTarget::dispatchEvent(event);120 m_asyncEventQueue->enqueueEvent(event.release()); 117 121 } 118 122 -
trunk/Source/WebCore/Modules/mediasource/SourceBufferList.h
r125424 r126946 41 41 42 42 class SourceBuffer; 43 class GenericEventQueue; 43 44 44 45 class SourceBufferList : public RefCounted<SourceBufferList>, public EventTarget { 45 46 public: 46 static PassRefPtr<SourceBufferList> create(ScriptExecutionContext* context )47 static PassRefPtr<SourceBufferList> create(ScriptExecutionContext* context, GenericEventQueue* asyncEventQueue) 47 48 { 48 return adoptRef(new SourceBufferList(context ));49 return adoptRef(new SourceBufferList(context, asyncEventQueue)); 49 50 } 50 51 virtual ~SourceBufferList() { } … … 73 74 74 75 private: 75 explicit SourceBufferList(ScriptExecutionContext*);76 SourceBufferList(ScriptExecutionContext*, GenericEventQueue*); 76 77 77 78 bool contains(size_t id) const; … … 83 84 EventTargetData m_eventTargetData; 84 85 ScriptExecutionContext* m_scriptExecutionContext; 86 GenericEventQueue* m_asyncEventQueue; 85 87 86 88 Vector<RefPtr<SourceBuffer> > m_list;
Note:
See TracChangeset
for help on using the changeset viewer.