Changeset 223960 in webkit
- Timestamp:
- Oct 25, 2017 10:39:47 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r223955 r223960 1 2017-10-25 Jer Noble <jer.noble@apple.com> 2 3 Autoplay muted videos still stop playback of other streaming apps in the background 4 https://bugs.webkit.org/show_bug.cgi?id=177920 5 6 Reviewed by Eric Carlson. 7 8 When creating a new <video> or <audio> element, the global AudioSession can sometimes have 9 its sessionCategory() set to "MediaPlayback", even if the element does not yet have a 10 source. This is because the constructor for the MediaElementSession is called before 11 m_isPlayingToWirelessTarget is initialized, and so in the MediaElementSession constructor, 12 the media element's m_isPlayingToWirelessTarget ivar is sometimes (uninitialized) true. 13 14 We could move the MediaElementSession ivar to the very end of the header, so it's 15 initialized last, but that still leaves the possibility of the MediaElementSession et. all 16 calling into the HTMLMediaElement before it's subclass's constructors have a chance to 17 initialize their own ivars (much less their vtables). So instead, we'll create and set the 18 MediaElementSession in a finishInitialization() method called from the HTMLVideoElement and 19 HTMLAudioElement's create() factory methods. 20 21 * html/HTMLAudioElement.cpp: 22 (WebCore::HTMLAudioElement::create): 23 * html/HTMLMediaElement.cpp: 24 (WebCore::HTMLMediaElement::HTMLMediaElement): 25 (WebCore::HTMLMediaElement::finishInitialization): 26 * html/HTMLMediaElement.h: 27 * html/HTMLVideoElement.cpp: 28 (WebCore::HTMLVideoElement::create): 29 1 30 2017-10-25 Javier Fernandez <jfernandez@igalia.com> 2 31 -
trunk/Source/WebCore/html/HTMLAudioElement.cpp
r217774 r223960 45 45 { 46 46 auto element = adoptRef(*new HTMLAudioElement(tagName, document, createdByParser)); 47 element->finishInitialization(); 47 48 element->suspendIfNeeded(); 48 49 return element; -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r223906 r223960 458 458 , m_processingPreferenceChange(false) 459 459 #endif 460 , m_mediaSession(std::make_unique<MediaElementSession>(*this))461 460 #if !RELEASE_LOG_DISABLED 462 461 , m_logger(&document.logger()) … … 469 468 470 469 setHasCustomStyleResolveCallbacks(); 470 } 471 472 void HTMLMediaElement::finishInitialization() 473 { 474 m_mediaSession = std::make_unique<MediaElementSession>(*this); 471 475 472 476 m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForFullscreen); … … 478 482 m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePlaybackToControlControlsManager); 479 483 484 auto& document = this->document(); 480 485 auto* page = document.page(); 481 486 -
trunk/Source/WebCore/html/HTMLMediaElement.h
r223802 r223960 546 546 protected: 547 547 HTMLMediaElement(const QualifiedName&, Document&, bool createdByParser); 548 virtual void finishInitialization(); 548 549 virtual ~HTMLMediaElement(); 549 550 -
trunk/Source/WebCore/html/HTMLVideoElement.cpp
r223644 r223960 65 65 { 66 66 auto videoElement = adoptRef(*new HTMLVideoElement(tagName, document, createdByParser)); 67 videoElement->finishInitialization(); 67 68 videoElement->suspendIfNeeded(); 68 69 return videoElement;
Note: See TracChangeset
for help on using the changeset viewer.