RESOLVED FIXED 76110
Event Queue for HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=76110
Summary Event Queue for HTMLMediaElement
Victor Carbune
Reported 2012-01-11 15:48:45 PST
The <track> element requires events to be dispatched asynchronously. Even though the HTMLMediaElement provides a particular mechanism for firing such events using a timer and a queue, a generic class should be in place that handles both events that are dispatched by the media element and the track element.
Attachments
Patch (14.00 KB, patch)
2012-01-20 02:03 PST, Victor Carbune
no flags
Updated patch. Renamed the class in GenericQueueEvent under dom/ and hopefully fixed build issues. (15.45 KB, patch)
2012-01-20 16:33 PST, Victor Carbune
no flags
Updated the vcproj entry as it was not building on win-ews (17.06 KB, patch)
2012-01-20 17:12 PST, Victor Carbune
no flags
Patch (16.55 KB, patch)
2012-01-21 00:48 PST, Victor Carbune
no flags
Green patch (16.13 KB, patch)
2012-01-21 01:43 PST, Victor Carbune
eric.carlson: review+
Dimitri Glazkov (Google)
Comment 1 2012-01-16 08:37:53 PST
Victor Carbune
Comment 2 2012-01-20 02:03:52 PST
Early Warning System Bot
Comment 3 2012-01-20 02:22:37 PST
Eric Carlson
Comment 4 2012-01-20 10:13:57 PST
Comment on attachment 123272 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=123272&action=review > Source/WebCore/html/HTMLMediaElement.h:581 > + MediaEventQueue m_asyncEventQueue; This shouldn't be inside of #if ENABLE(VIDEO_TRACK) as it is always used. This is causing the GTK and Qt bot failures.
Eric Carlson
Comment 5 2012-01-20 10:27:36 PST
Comment on attachment 123272 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=123272&action=review Marking r- only because it fails to compile on ports that don't define VIDEO_TRACK. > Source/WebCore/html/MediaEventQueue.cpp:8 > + Nit: This extra blank line is unnecessary. > Source/WebCore/html/MediaEventQueue.cpp:70 > + if (m_timer.isActive()) Nit: MediaEventQueue::close calls stop() without checking to see if the timer is active, to be consistent you should one or the other throughout the file. stop() is cheap so I would probably just call it but I don't have a strong preference.
Eric Carlson
Comment 6 2012-01-20 10:48:34 PST
Comment on attachment 123272 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=123272&action=review > Source/WebCore/html/MediaEventQueue.h:34 > +class MediaEventQueue : public EventQueue { > + > +public: > + MediaEventQueue(); > + virtual ~MediaEventQueue(); > + > + // EventQueue > + virtual bool enqueueEvent(PassRefPtr<Event>) OVERRIDE; > + virtual bool cancelEvent(Event*) OVERRIDE; > + virtual void close() OVERRIDE; > + > + void cancelAllEvents(); > + bool hasPendingEvents() const; > + > +private: > + void timerFired(Timer<MediaEventQueue>*); > + > + Vector<RefPtr<Event> > m_pendingEvents; > + Timer<MediaEventQueue> m_timer; > + > + bool m_isClosed; Why is this class called "MediaEventQueue"? We may end with a class that is specific to the media element at some point, but at this point it is just a generic event queue that could be used by other classes. I think this should a more generic name, GenericEventQueue or SimpleEventQueue perhaps, and it should be in WebCore/dom along with the abstract base class.
Victor Carbune
Comment 7 2012-01-20 16:33:16 PST
Created attachment 123407 [details] Updated patch. Renamed the class in GenericQueueEvent under dom/ and hopefully fixed build issues.
Victor Carbune
Comment 8 2012-01-20 17:12:00 PST
Created attachment 123416 [details] Updated the vcproj entry as it was not building on win-ews
Victor Carbune
Comment 9 2012-01-21 00:48:11 PST
Victor Carbune
Comment 10 2012-01-21 01:43:26 PST
Created attachment 123441 [details] Green patch Fixed build issues. Patch should be ready for review.
Eric Carlson
Comment 11 2012-01-24 06:58:41 PST
Comment on attachment 123441 [details] Green patch View in context: https://bugs.webkit.org/attachment.cgi?id=123441&action=review > Source/WebCore/html/HTMLMediaElement.cpp:-3181 > - // Return true when we have pending events so we can't fire events after the JS > - // object gets collected. Why remove this comment?
Dominic Cooney
Comment 12 2012-01-25 11:00:14 PST
I tried building this before landing it, and this did not build for me on Mac. It looks like it needs symbols added to WebCore exports. Here is the tail of the build output: Ld /Volumes/HD2/WebKit2/WebKitBuild/Debug/WebCore.framework/Versions/A/WebCore normal x86_64 cd /Volumes/HD2/WebKit2/Source/WebCore setenv MACOSX_DEPLOYMENT_TARGET 10.7 /Developer/usr/bin/clang++ -arch x86_64 -dynamiclib -L/Volumes/HD2/WebKit2/WebKitBuild/Debug -F/Volumes/HD2/WebKit2/WebKitBuild/Debug -F/System/Library/Frameworks/Carbon.framework/Frameworks -F/System/Library/Frameworks/ApplicationServices.framework/Frameworks -F/System/Library/Frameworks/CoreServices.framework/Frameworks -F/System/Library/PrivateFrameworks -filelist /Volumes/HD2/WebKit2/WebKitBuild/WebCore.build/Debug/WebCore.build/Objects-normal/x86_64/WebCore.LinkFileList -Xlinker --no-demangle -exported_symbols_list /Volumes/HD2/WebKit2/WebKitBuild/Debug/DerivedSources/WebCore/WebCore.LP64.exp -install_name /Volumes/HD2/WebKit2/WebKitBuild/Debug/WebCore.framework/Versions/A/WebCore -mmacosx-version-min=10.7 -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -sub_library libobjc -umbrella WebKit -allowable_client WebKit2 -Xlinker -objc_gc_compaction -framework IOSurface -framework Accelerate -framework ApplicationServices -framework AudioToolbox -framework AudioUnit -framework Carbon -framework Cocoa -framework CoreAudio -framework IOKit -framework JavaScriptCore -licucore -lobjc -lxml2 -lz -framework OpenGL -framework QuartzCore -framework SystemConfiguration -single_module -compatibility_version 1 -current_version 535.19 -o /Volumes/HD2/WebKit2/WebKitBuild/Debug/WebCore.framework/Versions/A/WebCore Undefined symbols for architecture x86_64: "__ZN7WebCore17GenericEventQueueC1Ev", referenced from: __ZN7WebCore16HTMLMediaElementC2ERKNS_13QualifiedNameEPNS_8DocumentEb in HTMLMediaElement.o "__ZN7WebCore17GenericEventQueueD1Ev", referenced from: __ZN7WebCore16HTMLMediaElementD2Ev in HTMLMediaElement.o "__ZN7WebCore17GenericEventQueue15cancelAllEventsEv", referenced from: __ZN7WebCore16HTMLMediaElement31cancelPendingEventsAndCallbacksEv in HTMLMediaElement.o "__ZNK7WebCore17GenericEventQueue16hasPendingEventsEv", referenced from: __ZNK7WebCore16HTMLMediaElement18hasPendingActivityEv in HTMLMediaElement.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) ** BUILD FAILED **
Eric Carlson
Comment 13 2012-01-27 14:57:20 PST
Note You need to log in before you can comment on or make changes to this bug.