Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 30 #include "bindings/core/v8/ScriptController.h" | 30 #include "bindings/core/v8/ScriptController.h" |
| 31 #include "bindings/core/v8/ScriptEventListener.h" | 31 #include "bindings/core/v8/ScriptEventListener.h" |
| 32 #include "bindings/core/v8/ScriptPromiseResolver.h" | 32 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
| 34 #include "core/css/MediaList.h" | 34 #include "core/css/MediaList.h" |
| 35 #include "core/dom/Attribute.h" | 35 #include "core/dom/Attribute.h" |
| 36 #include "core/dom/ElementTraversal.h" | 36 #include "core/dom/ElementTraversal.h" |
| 37 #include "core/dom/Fullscreen.h" | 37 #include "core/dom/Fullscreen.h" |
| 38 #include "core/dom/Microtask.h" | |
| 38 #include "core/dom/shadow/ShadowRoot.h" | 39 #include "core/dom/shadow/ShadowRoot.h" |
| 39 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
| 40 #include "core/frame/LocalFrame.h" | 41 #include "core/frame/LocalFrame.h" |
| 41 #include "core/frame/Settings.h" | 42 #include "core/frame/Settings.h" |
| 42 #include "core/frame/UseCounter.h" | 43 #include "core/frame/UseCounter.h" |
| 43 #include "core/frame/csp/ContentSecurityPolicy.h" | 44 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 44 #include "core/html/HTMLMediaSource.h" | 45 #include "core/html/HTMLMediaSource.h" |
| 45 #include "core/html/HTMLSourceElement.h" | 46 #include "core/html/HTMLSourceElement.h" |
| 46 #include "core/html/HTMLTrackElement.h" | 47 #include "core/html/HTMLTrackElement.h" |
| 47 #include "core/html/MediaError.h" | 48 #include "core/html/MediaError.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 } | 304 } |
| 304 | 305 |
| 305 bool HTMLMediaElement::isMediaStreamURL(const String& url) | 306 bool HTMLMediaElement::isMediaStreamURL(const String& url) |
| 306 { | 307 { |
| 307 return s_mediaStreamRegistry ? s_mediaStreamRegistry->contains(url) : false; | 308 return s_mediaStreamRegistry ? s_mediaStreamRegistry->contains(url) : false; |
| 308 } | 309 } |
| 309 | 310 |
| 310 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum ent) | 311 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum ent) |
| 311 : HTMLElement(tagName, document) | 312 : HTMLElement(tagName, document) |
| 312 , ActiveDOMObject(&document) | 313 , ActiveDOMObject(&document) |
| 313 , m_loadTimer(this, &HTMLMediaElement::loadTimerFired) | 314 , m_textTrackLoadTimer(this, &HTMLMediaElement::textTrackLoadTimerFired) |
| 314 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) | 315 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) |
| 315 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire d) | 316 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire d) |
| 316 , m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired) | 317 , m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired) |
| 317 , m_playedTimeRanges() | 318 , m_playedTimeRanges() |
| 318 , m_asyncEventQueue(GenericEventQueue::create(this)) | 319 , m_asyncEventQueue(GenericEventQueue::create(this)) |
| 319 , m_playbackRate(1.0f) | 320 , m_playbackRate(1.0f) |
| 320 , m_defaultPlaybackRate(1.0f) | 321 , m_defaultPlaybackRate(1.0f) |
| 321 , m_networkState(NETWORK_EMPTY) | 322 , m_networkState(NETWORK_EMPTY) |
| 322 , m_readyState(HAVE_NOTHING) | 323 , m_readyState(HAVE_NOTHING) |
| 323 , m_readyStateMaximum(HAVE_NOTHING) | 324 , m_readyStateMaximum(HAVE_NOTHING) |
| 324 , m_volume(1.0f) | 325 , m_volume(1.0f) |
| 325 , m_lastSeekTime(0) | 326 , m_lastSeekTime(0) |
| 326 , m_previousProgressTime(std::numeric_limits<double>::max()) | 327 , m_previousProgressTime(std::numeric_limits<double>::max()) |
| 327 , m_duration(std::numeric_limits<double>::quiet_NaN()) | 328 , m_duration(std::numeric_limits<double>::quiet_NaN()) |
| 328 , m_lastTimeUpdateEventWallTime(0) | 329 , m_lastTimeUpdateEventWallTime(0) |
| 329 , m_lastTimeUpdateEventMovieTime(0) | 330 , m_lastTimeUpdateEventMovieTime(0) |
| 330 , m_defaultPlaybackStartPosition(0) | 331 , m_defaultPlaybackStartPosition(0) |
| 331 , m_loadState(WaitingForSource) | 332 , m_loadState(WaitingForSource) |
| 332 , m_deferredLoadState(NotDeferred) | 333 , m_deferredLoadState(NotDeferred) |
| 333 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) | 334 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
| 334 , m_webLayer(nullptr) | 335 , m_webLayer(nullptr) |
| 335 , m_displayMode(Unknown) | 336 , m_displayMode(Unknown) |
| 336 , m_cachedTime(std::numeric_limits<double>::quiet_NaN()) | 337 , m_cachedTime(std::numeric_limits<double>::quiet_NaN()) |
| 337 , m_fragmentEndTime(std::numeric_limits<double>::quiet_NaN()) | 338 , m_fragmentEndTime(std::numeric_limits<double>::quiet_NaN()) |
| 338 , m_pendingActionFlags(0) | |
| 339 , m_userGestureRequiredForPlay(false) | 339 , m_userGestureRequiredForPlay(false) |
| 340 , m_playing(false) | 340 , m_playing(false) |
| 341 , m_shouldDelayLoadEvent(false) | 341 , m_shouldDelayLoadEvent(false) |
| 342 , m_haveFiredLoadedData(false) | 342 , m_haveFiredLoadedData(false) |
| 343 , m_autoplaying(true) | 343 , m_autoplaying(true) |
| 344 , m_muted(false) | 344 , m_muted(false) |
| 345 , m_paused(true) | 345 , m_paused(true) |
| 346 , m_seeking(false) | 346 , m_seeking(false) |
| 347 , m_sentStalledEvent(false) | 347 , m_sentStalledEvent(false) |
| 348 , m_sentEndEvent(false) | 348 , m_sentEndEvent(false) |
| 349 , m_closedCaptionsVisible(false) | 349 , m_closedCaptionsVisible(false) |
| 350 , m_ignorePreloadNone(false) | 350 , m_ignorePreloadNone(false) |
| 351 , m_tracksAreReady(true) | 351 , m_tracksAreReady(true) |
| 352 , m_processingPreferenceChange(false) | 352 , m_processingPreferenceChange(false) |
| 353 , m_remoteRoutesAvailable(false) | 353 , m_remoteRoutesAvailable(false) |
| 354 , m_playingRemotely(false) | 354 , m_playingRemotely(false) |
| 355 , m_isFinalizing(false) | 355 , m_isFinalizing(false) |
| 356 , m_initialPlayWithoutUserGesture(false) | 356 , m_initialPlayWithoutUserGesture(false) |
| 357 , m_autoplayMediaCounted(false) | 357 , m_autoplayMediaCounted(false) |
| 358 , m_inOverlayFullscreenVideo(false) | 358 , m_inOverlayFullscreenVideo(false) |
| 359 , m_audioTracks(AudioTrackList::create(*this)) | 359 , m_audioTracks(AudioTrackList::create(*this)) |
| 360 , m_videoTracks(VideoTrackList::create(*this)) | 360 , m_videoTracks(VideoTrackList::create(*this)) |
| 361 , m_textTracks(nullptr) | 361 , m_textTracks(nullptr) |
| 362 , m_playPromiseResolveTask(CancellableTaskFactory::create(this, &HTMLMediaEl ement::resolvePlayPromises)) | 362 , m_playPromiseResolveTask(CancellableTaskFactory::create(this, &HTMLMediaEl ement::resolvePlayPromises)) |
| 363 , m_playPromiseRejectTask(CancellableTaskFactory::create(this, &HTMLMediaEle ment::rejectPlayPromises)) | 363 , m_playPromiseRejectTask(CancellableTaskFactory::create(this, &HTMLMediaEle ment::rejectPlayPromises)) |
| 364 , m_resourceSelectionAlgorithmContinuationTask(CancellableTaskFactory::creat e(this, &HTMLMediaElement::continueResourceSelectionAlgorithm)) | |
| 364 , m_audioSourceNode(nullptr) | 365 , m_audioSourceNode(nullptr) |
| 365 , m_autoplayHelper(*this) | 366 , m_autoplayHelper(*this) |
| 366 { | 367 { |
| 367 #if ENABLE(OILPAN) | 368 #if ENABLE(OILPAN) |
| 368 ThreadState::current()->registerPreFinalizer(this); | 369 ThreadState::current()->registerPreFinalizer(this); |
| 369 #endif | 370 #endif |
| 370 | 371 |
| 371 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); | 372 WTF_LOG(Media, "HTMLMediaElement::HTMLMediaElement(%p)", this); |
| 372 | 373 |
| 373 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) | 374 if (document.settings() && document.settings()->mediaPlaybackRequiresUserGes ture()) |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 391 | 392 |
| 392 setShouldDelayLoadEvent(false); | 393 setShouldDelayLoadEvent(false); |
| 393 | 394 |
| 394 if (m_textTracks) | 395 if (m_textTracks) |
| 395 m_textTracks->clearOwner(); | 396 m_textTracks->clearOwner(); |
| 396 m_audioTracks->shutdown(); | 397 m_audioTracks->shutdown(); |
| 397 m_videoTracks->shutdown(); | 398 m_videoTracks->shutdown(); |
| 398 | 399 |
| 399 closeMediaSource(); | 400 closeMediaSource(); |
| 400 | 401 |
| 402 if (m_resourceSelectionAlgorithmContinuationTask->isPending()) | |
| 403 m_resourceSelectionAlgorithmContinuationTask->cancel(); | |
| 404 | |
| 401 removeElementFromDocumentMap(this, &document()); | 405 removeElementFromDocumentMap(this, &document()); |
| 402 | 406 |
| 403 // Destroying the player may cause a resource load to be canceled, | 407 // Destroying the player may cause a resource load to be canceled, |
| 404 // which could result in LocalDOMWindow::dispatchWindowLoadEvent() being | 408 // which could result in LocalDOMWindow::dispatchWindowLoadEvent() being |
| 405 // called via ResourceFetch::didLoadResource() then | 409 // called via ResourceFetch::didLoadResource() then |
| 406 // FrameLoader::checkCompleted(). To prevent load event dispatching during | 410 // FrameLoader::checkCompleted(). To prevent load event dispatching during |
| 407 // object destruction, we use Document::incrementLoadEventDelayCount(). | 411 // object destruction, we use Document::incrementLoadEventDelayCount(). |
| 408 // See http://crbug.com/275223 for more details. | 412 // See http://crbug.com/275223 for more details. |
| 409 document().incrementLoadEventDelayCount(); | 413 document().incrementLoadEventDelayCount(); |
| 410 | 414 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 593 void HTMLMediaElement::didRecalcStyle(StyleRecalcChange) | 597 void HTMLMediaElement::didRecalcStyle(StyleRecalcChange) |
| 594 { | 598 { |
| 595 if (layoutObject()) | 599 if (layoutObject()) |
| 596 layoutObject()->updateFromElement(); | 600 layoutObject()->updateFromElement(); |
| 597 } | 601 } |
| 598 | 602 |
| 599 void HTMLMediaElement::scheduleTextTrackResourceLoad() | 603 void HTMLMediaElement::scheduleTextTrackResourceLoad() |
| 600 { | 604 { |
| 601 WTF_LOG(Media, "HTMLMediaElement::scheduleTextTrackResourceLoad(%p)", this); | 605 WTF_LOG(Media, "HTMLMediaElement::scheduleTextTrackResourceLoad(%p)", this); |
| 602 | 606 |
| 603 m_pendingActionFlags |= LoadTextTrackResource; | 607 if (!m_textTrackLoadTimer.isActive()) |
| 604 | 608 m_textTrackLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 605 if (!m_loadTimer.isActive()) | |
| 606 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); | |
| 607 } | |
| 608 | |
| 609 void HTMLMediaElement::scheduleNextSourceChild() | |
| 610 { | |
| 611 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala invokeLoadAlgorithm. | |
| 612 m_pendingActionFlags |= LoadMediaResource; | |
| 613 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); | |
| 614 } | 609 } |
| 615 | 610 |
| 616 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 611 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
| 617 { | 612 { |
| 618 scheduleEvent(Event::createCancelable(eventName)); | 613 scheduleEvent(Event::createCancelable(eventName)); |
| 619 } | 614 } |
| 620 | 615 |
| 621 void HTMLMediaElement::scheduleEvent(PassRefPtrWillBeRawPtr<Event> event) | 616 void HTMLMediaElement::scheduleEvent(PassRefPtrWillBeRawPtr<Event> event) |
| 622 { | 617 { |
| 623 #if LOG_MEDIA_EVENTS | 618 #if LOG_MEDIA_EVENTS |
| 624 WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this , event->type().ascii().data()); | 619 WTF_LOG(Media, "HTMLMediaElement::scheduleEvent(%p) - scheduling '%s'", this , event->type().ascii().data()); |
| 625 #endif | 620 #endif |
| 626 m_asyncEventQueue->enqueueEvent(event); | 621 m_asyncEventQueue->enqueueEvent(event); |
| 627 } | 622 } |
| 628 | 623 |
| 629 void HTMLMediaElement::loadTimerFired(Timer<HTMLMediaElement>*) | 624 void HTMLMediaElement::textTrackLoadTimerFired(Timer<HTMLMediaElement>*) |
| 630 { | 625 { |
| 631 if (m_pendingActionFlags & LoadTextTrackResource) | 626 WTF_LOG(Media, "HTMLMediaElement::textTrackLoadTimerFired(%p)", this); |
| 632 honorUserPreferencesForAutomaticTextTrackSelection(); | 627 honorUserPreferencesForAutomaticTextTrackSelection(); |
| 633 | |
| 634 if (m_pendingActionFlags & LoadMediaResource) { | |
| 635 if (m_loadState == LoadingFromSourceElement) | |
| 636 loadNextSourceChild(); | |
| 637 else | |
| 638 loadInternal(); | |
| 639 } | |
| 640 | |
| 641 m_pendingActionFlags = 0; | |
| 642 } | 628 } |
| 643 | 629 |
| 644 MediaError* HTMLMediaElement::error() const | 630 MediaError* HTMLMediaElement::error() const |
| 645 { | 631 { |
| 646 return m_error; | 632 return m_error; |
| 647 } | 633 } |
| 648 | 634 |
| 649 void HTMLMediaElement::setSrc(const AtomicString& url) | 635 void HTMLMediaElement::setSrc(const AtomicString& url) |
| 650 { | 636 { |
| 651 setAttribute(srcAttr, url); | 637 setAttribute(srcAttr, url); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 728 // TODO(srirama.m): Currently m_ignorePreloadNone is reset before calling | 714 // TODO(srirama.m): Currently m_ignorePreloadNone is reset before calling |
| 729 // invokeLoadAlgorithm() in all places except load(). Move it inside here | 715 // invokeLoadAlgorithm() in all places except load(). Move it inside here |
| 730 // once microtask is implemented for "Await a stable state" step | 716 // once microtask is implemented for "Await a stable state" step |
| 731 // in resource selection algorithm. | 717 // in resource selection algorithm. |
| 732 void HTMLMediaElement::invokeLoadAlgorithm() | 718 void HTMLMediaElement::invokeLoadAlgorithm() |
| 733 { | 719 { |
| 734 WTF_LOG(Media, "HTMLMediaElement::invokeLoadAlgorithm(%p)", this); | 720 WTF_LOG(Media, "HTMLMediaElement::invokeLoadAlgorithm(%p)", this); |
| 735 | 721 |
| 736 // Perform the cleanup required for the resource load algorithm to run. | 722 // Perform the cleanup required for the resource load algorithm to run. |
| 737 stopPeriodicTimers(); | 723 stopPeriodicTimers(); |
| 738 m_loadTimer.stop(); | |
| 739 cancelDeferredLoad(); | 724 cancelDeferredLoad(); |
| 740 // FIXME: Figure out appropriate place to reset LoadTextTrackResource if nec essary and set m_pendingActionFlags to 0 here. | |
| 741 m_pendingActionFlags &= ~LoadMediaResource; | |
| 742 m_sentEndEvent = false; | 725 m_sentEndEvent = false; |
| 743 m_sentStalledEvent = false; | 726 m_sentStalledEvent = false; |
| 744 m_haveFiredLoadedData = false; | 727 m_haveFiredLoadedData = false; |
| 745 m_displayMode = Unknown; | 728 m_displayMode = Unknown; |
| 746 | 729 |
| 747 // 1 - Abort any already-running instance of the resource selection algorith m for this element. | 730 // 1 - Abort any already-running instance of the resource selection algorith m for this element. |
| 748 m_loadState = WaitingForSource; | 731 m_loadState = WaitingForSource; |
| 749 m_currentSourceNode = nullptr; | 732 m_currentSourceNode = nullptr; |
| 750 | 733 |
| 751 // 2 - If there are any tasks from the media element's media element event t ask source in | 734 // 2 - If there are any tasks from the media element's media element event t ask source in |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 826 // so they are closer to the relevant spec steps. | 809 // so they are closer to the relevant spec steps. |
| 827 m_lastSeekTime = 0; | 810 m_lastSeekTime = 0; |
| 828 m_duration = std::numeric_limits<double>::quiet_NaN(); | 811 m_duration = std::numeric_limits<double>::quiet_NaN(); |
| 829 | 812 |
| 830 // 3 - Set the media element's delaying-the-load-event flag to true (this de lays the load event) | 813 // 3 - Set the media element's delaying-the-load-event flag to true (this de lays the load event) |
| 831 setShouldDelayLoadEvent(true); | 814 setShouldDelayLoadEvent(true); |
| 832 if (mediaControls()) | 815 if (mediaControls()) |
| 833 mediaControls()->reset(); | 816 mediaControls()->reset(); |
| 834 | 817 |
| 835 // 4 - Await a stable state, allowing the task that invoked this algorithm t o continue | 818 // 4 - Await a stable state, allowing the task that invoked this algorithm t o continue |
| 836 // TODO(srirama.m): Remove scheduleNextSourceChild() and post a microtask in stead. | 819 enqueueMicrotaskForResourceSelectionAlgorithmContinuation(); |
| 837 // See http://crbug.com/593289 for more details. | 820 } |
| 838 scheduleNextSourceChild(); | 821 |
| 822 void HTMLMediaElement::continueResourceSelectionAlgorithm() | |
| 823 { | |
| 824 WTF_LOG(Media, "HTMLMediaElement::continueResourceSelectionAlgorithm(%p)", t his); | |
| 825 loadInternal(); | |
| 826 } | |
| 827 | |
| 828 void HTMLMediaElement::enqueueMicrotaskForResourceSelectionAlgorithmContinuation () | |
| 829 { | |
| 830 OwnPtr<WebTaskRunner::Task> task = adoptPtr(m_resourceSelectionAlgorithmCont inuationTask->cancelAndCreate()); | |
| 831 Microtask::enqueueMicrotask(task.release()); | |
| 839 } | 832 } |
| 840 | 833 |
| 841 void HTMLMediaElement::loadInternal() | 834 void HTMLMediaElement::loadInternal() |
| 842 { | 835 { |
| 843 // HTMLMediaElement::textTracksAreReady will need "... the text tracks whose mode was not in the | 836 // HTMLMediaElement::textTracksAreReady will need "... the text tracks whose mode was not in the |
| 844 // disabled state when the element's resource selection algorithm last start ed". | 837 // disabled state when the element's resource selection algorithm last start ed". |
| 845 m_textTracksWhenResourceSelectionBegan.clear(); | 838 m_textTracksWhenResourceSelectionBegan.clear(); |
| 846 if (m_textTracks) { | 839 if (m_textTracks) { |
| 847 for (unsigned i = 0; i < m_textTracks->length(); ++i) { | 840 for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
| 848 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); | 841 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1365 else | 1358 else |
| 1366 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - error event not sent, <source> was removed", this); | 1359 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - error event not sent, <source> was removed", this); |
| 1367 | 1360 |
| 1368 // 9.Otherwise.10 - Asynchronously await a stable state. The synchronous section consists of all the remaining steps of this algorithm until the algorit hm says the synchronous section has ended. | 1361 // 9.Otherwise.10 - Asynchronously await a stable state. The synchronous section consists of all the remaining steps of this algorithm until the algorit hm says the synchronous section has ended. |
| 1369 | 1362 |
| 1370 // 9.Otherwise.11 - Forget the media element's media-resource-specific t racks. | 1363 // 9.Otherwise.11 - Forget the media element's media-resource-specific t racks. |
| 1371 forgetResourceSpecificTracks(); | 1364 forgetResourceSpecificTracks(); |
| 1372 | 1365 |
| 1373 if (havePotentialSourceChild()) { | 1366 if (havePotentialSourceChild()) { |
| 1374 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - scheduling n ext <source>", this); | 1367 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - scheduling n ext <source>", this); |
| 1375 scheduleNextSourceChild(); | 1368 Microtask::enqueueMicrotask(WTF::bind(&HTMLMediaElement::loadNextSou rceChild, this)); |
|
philipj_slow
2016/04/06 12:06:52
Per spec the "await a stable state" is before forg
Srirama
2016/04/11 08:07:59
Done.
| |
| 1376 } else { | 1369 } else { |
| 1377 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - no more <sou rce> elements, waiting", this); | 1370 WTF_LOG(Media, "HTMLMediaElement::setNetworkState(%p) - no more <sou rce> elements, waiting", this); |
| 1378 waitForSourceChange(); | 1371 waitForSourceChange(); |
| 1379 } | 1372 } |
| 1380 | 1373 |
| 1381 return; | 1374 return; |
| 1382 } | 1375 } |
| 1383 | 1376 |
| 1384 if (error == WebMediaPlayer::NetworkStateNetworkError && m_readyState >= HAV E_METADATA) | 1377 if (error == WebMediaPlayer::NetworkStateNetworkError && m_readyState >= HAV E_METADATA) |
| 1385 mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK)); | 1378 mediaEngineError(MediaError::create(MediaError::MEDIA_ERR_NETWORK)); |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2765 // 22. Asynchronously await a stable state... | 2758 // 22. Asynchronously await a stable state... |
| 2766 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case | 2759 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case |
| 2767 // it hasn't been fired yet). | 2760 // it hasn't been fired yet). |
| 2768 setShouldDelayLoadEvent(true); | 2761 setShouldDelayLoadEvent(true); |
| 2769 | 2762 |
| 2770 // 24. Set the networkState back to NETWORK_LOADING. | 2763 // 24. Set the networkState back to NETWORK_LOADING. |
| 2771 setNetworkState(NETWORK_LOADING); | 2764 setNetworkState(NETWORK_LOADING); |
| 2772 | 2765 |
| 2773 // 25. Jump back to the find next candidate step above. | 2766 // 25. Jump back to the find next candidate step above. |
| 2774 m_nextChildNodeToConsider = source; | 2767 m_nextChildNodeToConsider = source; |
| 2775 scheduleNextSourceChild(); | 2768 loadNextSourceChild(); |
|
philipj_slow
2016/04/06 12:06:52
If there are many source children, will this recur
Srirama
2016/04/11 08:07:59
I wrote a test content like below.
***************
philipj_slow
2016/04/19 14:52:44
Can you change the test so that it appends 10000 p
| |
| 2776 } | 2769 } |
| 2777 | 2770 |
| 2778 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) | 2771 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
| 2779 { | 2772 { |
| 2780 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p, %p)", this, source); | 2773 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p, %p)", this, source); |
| 2781 | 2774 |
| 2782 #if !LOG_DISABLED | 2775 #if !LOG_DISABLED |
| 2783 KURL url = source->getNonEmptyURLAttribute(srcAttr); | 2776 KURL url = source->getNonEmptyURLAttribute(srcAttr); |
| 2784 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data()); | 2777 WTF_LOG(Media, "HTMLMediaElement::sourceWasRemoved(%p) - 'src' is %s", this, urlForLoggingMedia(url).utf8().data()); |
| 2785 #endif | 2778 #endif |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3103 closeMediaSource(); | 3096 closeMediaSource(); |
| 3104 | 3097 |
| 3105 cancelDeferredLoad(); | 3098 cancelDeferredLoad(); |
| 3106 | 3099 |
| 3107 { | 3100 { |
| 3108 AudioSourceProviderClientLockScope scope(*this); | 3101 AudioSourceProviderClientLockScope scope(*this); |
| 3109 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3102 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3110 } | 3103 } |
| 3111 | 3104 |
| 3112 stopPeriodicTimers(); | 3105 stopPeriodicTimers(); |
| 3113 m_loadTimer.stop(); | 3106 m_textTrackLoadTimer.stop(); |
| 3114 | 3107 |
| 3115 m_pendingActionFlags = 0; | |
| 3116 m_loadState = WaitingForSource; | 3108 m_loadState = WaitingForSource; |
| 3117 | 3109 |
| 3118 // We can't cast if we don't have a media player. | 3110 // We can't cast if we don't have a media player. |
| 3119 m_remoteRoutesAvailable = false; | 3111 m_remoteRoutesAvailable = false; |
| 3120 m_playingRemotely = false; | 3112 m_playingRemotely = false; |
| 3121 if (mediaControls()) | 3113 if (mediaControls()) |
| 3122 mediaControls()->refreshCastButtonVisibilityWithoutUpdate(); | 3114 mediaControls()->refreshCastButtonVisibilityWithoutUpdate(); |
| 3123 | 3115 |
| 3124 if (layoutObject()) | 3116 if (layoutObject()) |
| 3125 layoutObject()->setShouldDoFullPaintInvalidation(); | 3117 layoutObject()->setShouldDoFullPaintInvalidation(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3179 | 3171 |
| 3180 // When connected to a MediaSource, e.g. setting MediaSource.duration will c ause a | 3172 // When connected to a MediaSource, e.g. setting MediaSource.duration will c ause a |
| 3181 // durationchange event to be fired. | 3173 // durationchange event to be fired. |
| 3182 if (m_mediaSource) | 3174 if (m_mediaSource) |
| 3183 return true; | 3175 return true; |
| 3184 | 3176 |
| 3185 // Wait for any pending events to be fired. | 3177 // Wait for any pending events to be fired. |
| 3186 if (m_asyncEventQueue->hasPendingEvents()) | 3178 if (m_asyncEventQueue->hasPendingEvents()) |
| 3187 return true; | 3179 return true; |
| 3188 | 3180 |
| 3181 // Wait for any pending microtask to be fired. | |
| 3182 if (m_resourceSelectionAlgorithmContinuationTask->isPending()) | |
|
philipj_slow
2016/04/06 12:06:52
Now that we're in an Oilpan only world I'm not ent
Srirama
2016/04/11 08:07:59
I think it will be a strong pointer (ownptr), isn'
| |
| 3183 return true; | |
| 3184 | |
| 3189 return false; | 3185 return false; |
| 3190 } | 3186 } |
| 3191 | 3187 |
| 3192 bool HTMLMediaElement::isFullscreen() const | 3188 bool HTMLMediaElement::isFullscreen() const |
| 3193 { | 3189 { |
| 3194 return Fullscreen::isActiveFullScreenElement(*this); | 3190 return Fullscreen::isActiveFullScreenElement(*this); |
| 3195 } | 3191 } |
| 3196 | 3192 |
| 3197 void HTMLMediaElement::enterFullscreen() | 3193 void HTMLMediaElement::enterFullscreen() |
| 3198 { | 3194 { |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3804 { | 3800 { |
| 3805 visitor->trace(m_client); | 3801 visitor->trace(m_client); |
| 3806 } | 3802 } |
| 3807 | 3803 |
| 3808 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3804 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
| 3809 { | 3805 { |
| 3810 visitor->trace(m_client); | 3806 visitor->trace(m_client); |
| 3811 } | 3807 } |
| 3812 | 3808 |
| 3813 } // namespace blink | 3809 } // namespace blink |
| OLD | NEW |