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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 | 381 |
| 382 bool HTMLMediaElement::isMediaStreamURL(const String& url) | 382 bool HTMLMediaElement::isMediaStreamURL(const String& url) |
| 383 { | 383 { |
| 384 return s_mediaStreamRegistry ? s_mediaStreamRegistry->contains(url) : false; | 384 return s_mediaStreamRegistry ? s_mediaStreamRegistry->contains(url) : false; |
| 385 } | 385 } |
| 386 | 386 |
| 387 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum ent) | 387 HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum ent) |
| 388 : HTMLElement(tagName, document) | 388 : HTMLElement(tagName, document) |
| 389 , ActiveScriptWrappable(this) | 389 , ActiveScriptWrappable(this) |
| 390 , ActiveDOMObject(&document) | 390 , ActiveDOMObject(&document) |
| 391 , m_loadTimer(this, &HTMLMediaElement::loadTimerFired) | 391 , m_textTrackLoadTimer(this, &HTMLMediaElement::textTrackLoadTimerFired) |
| 392 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) | 392 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) |
| 393 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire d) | 393 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFire d) |
| 394 , m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired) | 394 , m_audioTracksTimer(this, &HTMLMediaElement::audioTracksTimerFired) |
| 395 , m_playedTimeRanges() | 395 , m_playedTimeRanges() |
| 396 , m_asyncEventQueue(GenericEventQueue::create(this)) | 396 , m_asyncEventQueue(GenericEventQueue::create(this)) |
| 397 , m_playbackRate(1.0f) | 397 , m_playbackRate(1.0f) |
| 398 , m_defaultPlaybackRate(1.0f) | 398 , m_defaultPlaybackRate(1.0f) |
| 399 , m_networkState(kNetworkEmpty) | 399 , m_networkState(kNetworkEmpty) |
| 400 , m_readyState(kHaveNothing) | 400 , m_readyState(kHaveNothing) |
| 401 , m_readyStateMaximum(kHaveNothing) | 401 , m_readyStateMaximum(kHaveNothing) |
| 402 , m_volume(1.0f) | 402 , m_volume(1.0f) |
| 403 , m_lastSeekTime(0) | 403 , m_lastSeekTime(0) |
| 404 , m_previousProgressTime(std::numeric_limits<double>::max()) | 404 , m_previousProgressTime(std::numeric_limits<double>::max()) |
| 405 , m_duration(std::numeric_limits<double>::quiet_NaN()) | 405 , m_duration(std::numeric_limits<double>::quiet_NaN()) |
| 406 , m_lastTimeUpdateEventWallTime(0) | 406 , m_lastTimeUpdateEventWallTime(0) |
| 407 , m_lastTimeUpdateEventMovieTime(0) | 407 , m_lastTimeUpdateEventMovieTime(0) |
| 408 , m_defaultPlaybackStartPosition(0) | 408 , m_defaultPlaybackStartPosition(0) |
| 409 , m_loadState(WaitingForSource) | 409 , m_loadState(WaitingForSource) |
| 410 , m_deferredLoadState(NotDeferred) | 410 , m_deferredLoadState(NotDeferred) |
| 411 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) | 411 , m_deferredLoadTimer(this, &HTMLMediaElement::deferredLoadTimerFired) |
| 412 , m_webLayer(nullptr) | 412 , m_webLayer(nullptr) |
| 413 , m_displayMode(Unknown) | 413 , m_displayMode(Unknown) |
| 414 , m_cachedTime(std::numeric_limits<double>::quiet_NaN()) | 414 , m_cachedTime(std::numeric_limits<double>::quiet_NaN()) |
| 415 , m_fragmentEndTime(std::numeric_limits<double>::quiet_NaN()) | 415 , m_fragmentEndTime(std::numeric_limits<double>::quiet_NaN()) |
| 416 , m_pendingActionFlags(0) | |
| 417 , m_lockedPendingUserGesture(false) | 416 , m_lockedPendingUserGesture(false) |
| 418 , m_playing(false) | 417 , m_playing(false) |
| 419 , m_shouldDelayLoadEvent(false) | 418 , m_shouldDelayLoadEvent(false) |
| 420 , m_haveFiredLoadedData(false) | 419 , m_haveFiredLoadedData(false) |
| 421 , m_autoplaying(true) | 420 , m_autoplaying(true) |
| 422 , m_muted(false) | 421 , m_muted(false) |
| 423 , m_paused(true) | 422 , m_paused(true) |
| 424 , m_seeking(false) | 423 , m_seeking(false) |
| 425 , m_sentStalledEvent(false) | 424 , m_sentStalledEvent(false) |
| 426 , m_ignorePreloadNone(false) | 425 , m_ignorePreloadNone(false) |
| 427 , m_textTracksVisible(false) | 426 , m_textTracksVisible(false) |
| 428 , m_shouldPerformAutomaticTrackSelection(true) | 427 , m_shouldPerformAutomaticTrackSelection(true) |
| 429 , m_tracksAreReady(true) | 428 , m_tracksAreReady(true) |
| 430 , m_processingPreferenceChange(false) | 429 , m_processingPreferenceChange(false) |
| 431 , m_remoteRoutesAvailable(false) | 430 , m_remoteRoutesAvailable(false) |
| 432 , m_playingRemotely(false) | 431 , m_playingRemotely(false) |
| 433 , m_inOverlayFullscreenVideo(false) | 432 , m_inOverlayFullscreenVideo(false) |
| 434 , m_audioTracks(AudioTrackList::create(*this)) | 433 , m_audioTracks(AudioTrackList::create(*this)) |
| 435 , m_videoTracks(VideoTrackList::create(*this)) | 434 , m_videoTracks(VideoTrackList::create(*this)) |
| 436 , m_textTracks(nullptr) | 435 , m_textTracks(nullptr) |
| 437 , m_playPromiseResolveTask(CancellableTaskFactory::create(this, &HTMLMediaEl ement::resolveScheduledPlayPromises)) | 436 , m_playPromiseResolveTask(CancellableTaskFactory::create(this, &HTMLMediaEl ement::resolveScheduledPlayPromises)) |
| 438 , m_playPromiseRejectTask(CancellableTaskFactory::create(this, &HTMLMediaEle ment::rejectScheduledPlayPromises)) | 437 , m_playPromiseRejectTask(CancellableTaskFactory::create(this, &HTMLMediaEle ment::rejectScheduledPlayPromises)) |
| 438 , m_resourceSelectionAlgorithmContinuationTask(CancellableTaskFactory::creat e(this, &HTMLMediaElement::continueResourceSelectionAlgorithm)) | |
| 439 , m_loadNextSourceChildAfterErrorTask(CancellableTaskFactory::create(this, & HTMLMediaElement::loadNextSourceChildAfterError)) | |
| 439 , m_audioSourceNode(nullptr) | 440 , m_audioSourceNode(nullptr) |
| 440 , m_autoplayHelperClient(AutoplayHelperClientImpl::create(this)) | 441 , m_autoplayHelperClient(AutoplayHelperClientImpl::create(this)) |
| 441 , m_autoplayHelper(AutoplayExperimentHelper::create(m_autoplayHelperClient.g et())) | 442 , m_autoplayHelper(AutoplayExperimentHelper::create(m_autoplayHelperClient.g et())) |
| 442 , m_autoplayUmaHelper(AutoplayUmaHelper::create(this)) | 443 , m_autoplayUmaHelper(AutoplayUmaHelper::create(this)) |
| 443 , m_remotePlaybackClient(nullptr) | 444 , m_remotePlaybackClient(nullptr) |
| 444 , m_autoplayVisibilityObserver(nullptr) | 445 , m_autoplayVisibilityObserver(nullptr) |
| 445 { | 446 { |
| 446 ThreadState::current()->registerPreFinalizer(this); | 447 ThreadState::current()->registerPreFinalizer(this); |
| 447 | 448 |
| 448 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; | 449 BLINK_MEDIA_LOG << "HTMLMediaElement(" << (void*)this << ")"; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 628 void HTMLMediaElement::didRecalcStyle(StyleRecalcChange) | 629 void HTMLMediaElement::didRecalcStyle(StyleRecalcChange) |
| 629 { | 630 { |
| 630 if (layoutObject()) | 631 if (layoutObject()) |
| 631 layoutObject()->updateFromElement(); | 632 layoutObject()->updateFromElement(); |
| 632 } | 633 } |
| 633 | 634 |
| 634 void HTMLMediaElement::scheduleTextTrackResourceLoad() | 635 void HTMLMediaElement::scheduleTextTrackResourceLoad() |
| 635 { | 636 { |
| 636 BLINK_MEDIA_LOG << "scheduleTextTrackResourceLoad(" << (void*)this << ")"; | 637 BLINK_MEDIA_LOG << "scheduleTextTrackResourceLoad(" << (void*)this << ")"; |
| 637 | 638 |
| 638 m_pendingActionFlags |= LoadTextTrackResource; | 639 if (!m_textTrackLoadTimer.isActive()) |
| 639 | 640 m_textTrackLoadTimer.startOneShot(0, BLINK_FROM_HERE); |
| 640 if (!m_loadTimer.isActive()) | |
| 641 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); | |
| 642 } | |
| 643 | |
| 644 void HTMLMediaElement::scheduleNextSourceChild() | |
| 645 { | |
| 646 // Schedule the timer to try the next <source> element WITHOUT resetting sta te ala invokeLoadAlgorithm. | |
| 647 m_pendingActionFlags |= LoadMediaResource; | |
| 648 m_loadTimer.startOneShot(0, BLINK_FROM_HERE); | |
| 649 } | 641 } |
| 650 | 642 |
| 651 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) | 643 void HTMLMediaElement::scheduleEvent(const AtomicString& eventName) |
| 652 { | 644 { |
| 653 scheduleEvent(Event::createCancelable(eventName)); | 645 scheduleEvent(Event::createCancelable(eventName)); |
| 654 } | 646 } |
| 655 | 647 |
| 656 void HTMLMediaElement::scheduleEvent(Event* event) | 648 void HTMLMediaElement::scheduleEvent(Event* event) |
| 657 { | 649 { |
| 658 #if LOG_MEDIA_EVENTS | 650 #if LOG_MEDIA_EVENTS |
| 659 BLINK_MEDIA_LOG << "scheduleEvent(" << (void*)this << ")" << " - scheduling '" << event->type() << "'"; | 651 BLINK_MEDIA_LOG << "scheduleEvent(" << (void*)this << ")" << " - scheduling '" << event->type() << "'"; |
| 660 #endif | 652 #endif |
| 661 m_asyncEventQueue->enqueueEvent(event); | 653 m_asyncEventQueue->enqueueEvent(event); |
| 662 } | 654 } |
| 663 | 655 |
| 664 void HTMLMediaElement::loadTimerFired(TimerBase*) | 656 void HTMLMediaElement::textTrackLoadTimerFired(TimerBase*) |
| 665 { | 657 { |
| 666 if (m_pendingActionFlags & LoadTextTrackResource) | 658 BLINK_MEDIA_LOG << "HTMLMediaElement::textTrackLoadTimerFired(" << (void*)th is << ")"; |
| 667 honorUserPreferencesForAutomaticTextTrackSelection(); | 659 honorUserPreferencesForAutomaticTextTrackSelection(); |
| 668 | |
| 669 if (m_pendingActionFlags & LoadMediaResource) { | |
| 670 if (m_loadState == LoadingFromSourceElement) | |
| 671 loadNextSourceChild(); | |
| 672 else | |
| 673 loadInternal(); | |
| 674 } | |
| 675 | |
| 676 m_pendingActionFlags = 0; | |
| 677 } | 660 } |
| 678 | 661 |
| 679 MediaError* HTMLMediaElement::error() const | 662 MediaError* HTMLMediaElement::error() const |
| 680 { | 663 { |
| 681 return m_error; | 664 return m_error; |
| 682 } | 665 } |
| 683 | 666 |
| 684 void HTMLMediaElement::setSrc(const AtomicString& url) | 667 void HTMLMediaElement::setSrc(const AtomicString& url) |
| 685 { | 668 { |
| 686 setAttribute(srcAttr, url); | 669 setAttribute(srcAttr, url); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 734 // TODO(srirama.m): Currently m_ignorePreloadNone is reset before calling | 717 // TODO(srirama.m): Currently m_ignorePreloadNone is reset before calling |
| 735 // invokeLoadAlgorithm() in all places except load(). Move it inside here | 718 // invokeLoadAlgorithm() in all places except load(). Move it inside here |
| 736 // once microtask is implemented for "Await a stable state" step | 719 // once microtask is implemented for "Await a stable state" step |
| 737 // in resource selection algorithm. | 720 // in resource selection algorithm. |
| 738 void HTMLMediaElement::invokeLoadAlgorithm() | 721 void HTMLMediaElement::invokeLoadAlgorithm() |
| 739 { | 722 { |
| 740 BLINK_MEDIA_LOG << "invokeLoadAlgorithm(" << (void*)this << ")"; | 723 BLINK_MEDIA_LOG << "invokeLoadAlgorithm(" << (void*)this << ")"; |
| 741 | 724 |
| 742 // Perform the cleanup required for the resource load algorithm to run. | 725 // Perform the cleanup required for the resource load algorithm to run. |
| 743 stopPeriodicTimers(); | 726 stopPeriodicTimers(); |
| 744 m_loadTimer.stop(); | |
| 745 cancelDeferredLoad(); | 727 cancelDeferredLoad(); |
| 746 // FIXME: Figure out appropriate place to reset LoadTextTrackResource if nec essary and set m_pendingActionFlags to 0 here. | |
| 747 m_pendingActionFlags &= ~LoadMediaResource; | |
| 748 m_sentStalledEvent = false; | 728 m_sentStalledEvent = false; |
| 749 m_haveFiredLoadedData = false; | 729 m_haveFiredLoadedData = false; |
| 750 m_displayMode = Unknown; | 730 m_displayMode = Unknown; |
| 751 | 731 |
| 752 // 1 - Abort any already-running instance of the resource selection algorith m for this element. | 732 // 1 - Abort any already-running instance of the resource selection algorith m for this element. |
| 733 m_resourceSelectionAlgorithmContinuationTask->cancel(); | |
| 734 m_loadNextSourceChildAfterErrorTask->cancel(); | |
| 753 m_loadState = WaitingForSource; | 735 m_loadState = WaitingForSource; |
| 754 m_currentSourceNode = nullptr; | 736 m_currentSourceNode = nullptr; |
| 755 | 737 |
| 756 // 2 - Let pending tasks be a list of tasks from the media element's media | 738 // 2 - Let pending tasks be a list of tasks from the media element's media |
| 757 // element task source in one of the task queues. | 739 // element task source in one of the task queues. |
| 758 // | 740 // |
| 759 // 3 - For each task in the pending tasks that would run resolve pending | 741 // 3 - For each task in the pending tasks that would run resolve pending |
| 760 // play promises or project pending play prmoises algorithms, immediately | 742 // play promises or project pending play prmoises algorithms, immediately |
| 761 // resolve or reject those promises in the order the corresponding tasks | 743 // resolve or reject those promises in the order the corresponding tasks |
| 762 // were queued. | 744 // were queued. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 // so they are closer to the relevant spec steps. | 845 // so they are closer to the relevant spec steps. |
| 864 m_lastSeekTime = 0; | 846 m_lastSeekTime = 0; |
| 865 m_duration = std::numeric_limits<double>::quiet_NaN(); | 847 m_duration = std::numeric_limits<double>::quiet_NaN(); |
| 866 | 848 |
| 867 // 3 - Set the media element's delaying-the-load-event flag to true (this de lays the load event) | 849 // 3 - Set the media element's delaying-the-load-event flag to true (this de lays the load event) |
| 868 setShouldDelayLoadEvent(true); | 850 setShouldDelayLoadEvent(true); |
| 869 if (mediaControls()) | 851 if (mediaControls()) |
| 870 mediaControls()->reset(); | 852 mediaControls()->reset(); |
| 871 | 853 |
| 872 // 4 - Await a stable state, allowing the task that invoked this algorithm t o continue | 854 // 4 - Await a stable state, allowing the task that invoked this algorithm t o continue |
| 873 // TODO(srirama.m): Remove scheduleNextSourceChild() and post a microtask in stead. | 855 Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FRO M_HERE, m_resourceSelectionAlgorithmContinuationTask->cancelAndCreate()); |
|
foolip
2016/09/02 10:31:00
Just to be clear, this and the below use of Platfo
| |
| 874 // See http://crbug.com/593289 for more details. | 856 } |
| 875 scheduleNextSourceChild(); | 857 |
| 858 void HTMLMediaElement::continueResourceSelectionAlgorithm() | |
| 859 { | |
| 860 BLINK_MEDIA_LOG << "HTMLMediaElement::continueResourceSelectionAlgorithm(" < < (void*)this << ")"; | |
| 861 loadInternal(); | |
| 876 } | 862 } |
| 877 | 863 |
| 878 void HTMLMediaElement::loadInternal() | 864 void HTMLMediaElement::loadInternal() |
| 879 { | 865 { |
| 880 // HTMLMediaElement::textTracksAreReady will need "... the text tracks whose mode was not in the | 866 // HTMLMediaElement::textTracksAreReady will need "... the text tracks whose mode was not in the |
| 881 // disabled state when the element's resource selection algorithm last start ed". | 867 // disabled state when the element's resource selection algorithm last start ed". |
| 882 m_textTracksWhenResourceSelectionBegan.clear(); | 868 m_textTracksWhenResourceSelectionBegan.clear(); |
| 883 if (m_textTracks) { | 869 if (m_textTracks) { |
| 884 for (unsigned i = 0; i < m_textTracks->length(); ++i) { | 870 for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
| 885 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); | 871 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 995 return; | 981 return; |
| 996 } | 982 } |
| 997 | 983 |
| 998 // Reset the MediaPlayer and MediaSource if any | 984 // Reset the MediaPlayer and MediaSource if any |
| 999 resetMediaPlayerAndMediaSource(); | 985 resetMediaPlayerAndMediaSource(); |
| 1000 | 986 |
| 1001 m_loadState = LoadingFromSourceElement; | 987 m_loadState = LoadingFromSourceElement; |
| 1002 loadResource(WebMediaPlayerSource(WebURL(mediaURL)), contentType); | 988 loadResource(WebMediaPlayerSource(WebURL(mediaURL)), contentType); |
| 1003 } | 989 } |
| 1004 | 990 |
| 991 void HTMLMediaElement::loadNextSourceChildAfterError() | |
| 992 { | |
| 993 // 9.Otherwise.11 - Forget the media element's media-resource-specific track s. | |
| 994 forgetResourceSpecificTracks(); | |
| 995 loadNextSourceChild(); | |
| 996 } | |
| 997 | |
| 1005 void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, const Co ntentType& contentType) | 998 void HTMLMediaElement::loadResource(const WebMediaPlayerSource& source, const Co ntentType& contentType) |
| 1006 { | 999 { |
| 1007 DCHECK(isMainThread()); | 1000 DCHECK(isMainThread()); |
| 1008 KURL url; | 1001 KURL url; |
| 1009 if (source.isURL()) { | 1002 if (source.isURL()) { |
| 1010 url = source.getAsURL(); | 1003 url = source.getAsURL(); |
| 1011 DCHECK(isSafeToLoadURL(url, Complain)); | 1004 DCHECK(isSafeToLoadURL(url, Complain)); |
| 1012 BLINK_MEDIA_LOG << "loadResource(" << (void*)this << ", " << urlForLoggi ngMedia(url) << ", " << contentType.raw() << ")"; | 1005 BLINK_MEDIA_LOG << "loadResource(" << (void*)this << ", " << urlForLoggi ngMedia(url) << ", " << contentType.raw() << ")"; |
| 1013 } | 1006 } |
| 1014 | 1007 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1433 if (m_readyState < kHaveMetadata && m_loadState == LoadingFromSourceElement) { | 1426 if (m_readyState < kHaveMetadata && m_loadState == LoadingFromSourceElement) { |
| 1434 | 1427 |
| 1435 // resource selection algorithm | 1428 // resource selection algorithm |
| 1436 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DO M manipulation task source, to fire a simple event named error at the candidate element. | 1429 // Step 9.Otherwise.9 - Failed with elements: Queue a task, using the DO M manipulation task source, to fire a simple event named error at the candidate element. |
| 1437 if (m_currentSourceNode) | 1430 if (m_currentSourceNode) |
| 1438 m_currentSourceNode->scheduleErrorEvent(); | 1431 m_currentSourceNode->scheduleErrorEvent(); |
| 1439 else | 1432 else |
| 1440 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ") - error e vent not sent, <source> was removed"; | 1433 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ") - error e vent not sent, <source> was removed"; |
| 1441 | 1434 |
| 1442 // 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. | 1435 // 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. |
| 1443 | |
| 1444 // 9.Otherwise.11 - Forget the media element's media-resource-specific t racks. | |
| 1445 forgetResourceSpecificTracks(); | |
| 1446 | |
| 1447 if (havePotentialSourceChild()) { | 1436 if (havePotentialSourceChild()) { |
| 1448 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ") - schedul ing next <source>"; | 1437 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ") - schedul ing next <source>"; |
| 1449 scheduleNextSourceChild(); | 1438 Platform::current()->currentThread()->getWebTaskRunner()->postTask(B LINK_FROM_HERE, m_loadNextSourceChildAfterErrorTask->cancelAndCreate()); |
| 1450 } else { | 1439 } else { |
| 1451 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ") - no more <source> elements, waiting"; | 1440 BLINK_MEDIA_LOG << "setNetworkState(" << (void*)this << ") - no more <source> elements, waiting"; |
| 1452 waitForSourceChange(); | 1441 waitForSourceChange(); |
| 1453 } | 1442 } |
| 1454 | 1443 |
| 1455 return; | 1444 return; |
| 1456 } | 1445 } |
| 1457 | 1446 |
| 1458 if (error == WebMediaPlayer::NetworkStateNetworkError && m_readyState >= kHa veMetadata) | 1447 if (error == WebMediaPlayer::NetworkStateNetworkError && m_readyState >= kHa veMetadata) |
| 1459 mediaEngineError(MediaError::create(MediaError::kMediaErrNetwork)); | 1448 mediaEngineError(MediaError::create(MediaError::kMediaErrNetwork)); |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2848 // 22. Asynchronously await a stable state... | 2837 // 22. Asynchronously await a stable state... |
| 2849 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case | 2838 // 23. Set the element's delaying-the-load-event flag back to true (this del ays the load event again, in case |
| 2850 // it hasn't been fired yet). | 2839 // it hasn't been fired yet). |
| 2851 setShouldDelayLoadEvent(true); | 2840 setShouldDelayLoadEvent(true); |
| 2852 | 2841 |
| 2853 // 24. Set the networkState back to NETWORK_LOADING. | 2842 // 24. Set the networkState back to NETWORK_LOADING. |
| 2854 setNetworkState(kNetworkLoading); | 2843 setNetworkState(kNetworkLoading); |
| 2855 | 2844 |
| 2856 // 25. Jump back to the find next candidate step above. | 2845 // 25. Jump back to the find next candidate step above. |
| 2857 m_nextChildNodeToConsider = source; | 2846 m_nextChildNodeToConsider = source; |
| 2858 scheduleNextSourceChild(); | 2847 loadNextSourceChild(); |
| 2859 } | 2848 } |
| 2860 | 2849 |
| 2861 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) | 2850 void HTMLMediaElement::sourceWasRemoved(HTMLSourceElement* source) |
| 2862 { | 2851 { |
| 2863 BLINK_MEDIA_LOG << "sourceWasRemoved(" << (void*)this << ", " << source << " )"; | 2852 BLINK_MEDIA_LOG << "sourceWasRemoved(" << (void*)this << ", " << source << " )"; |
| 2864 | 2853 |
| 2865 KURL url = source->getNonEmptyURLAttribute(srcAttr); | 2854 KURL url = source->getNonEmptyURLAttribute(srcAttr); |
| 2866 BLINK_MEDIA_LOG << "sourceWasRemoved(" << (void*)this << ") - 'src' is " << urlForLoggingMedia(url); | 2855 BLINK_MEDIA_LOG << "sourceWasRemoved(" << (void*)this << ") - 'src' is " << urlForLoggingMedia(url); |
| 2867 | 2856 |
| 2868 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) | 2857 if (source != m_currentSourceNode && source != m_nextChildNodeToConsider) |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3196 closeMediaSource(); | 3185 closeMediaSource(); |
| 3197 | 3186 |
| 3198 cancelDeferredLoad(); | 3187 cancelDeferredLoad(); |
| 3199 | 3188 |
| 3200 { | 3189 { |
| 3201 AudioSourceProviderClientLockScope scope(*this); | 3190 AudioSourceProviderClientLockScope scope(*this); |
| 3202 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 3191 clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
| 3203 } | 3192 } |
| 3204 | 3193 |
| 3205 stopPeriodicTimers(); | 3194 stopPeriodicTimers(); |
| 3206 m_loadTimer.stop(); | 3195 m_textTrackLoadTimer.stop(); |
| 3207 | 3196 |
| 3208 m_pendingActionFlags = 0; | |
| 3209 m_loadState = WaitingForSource; | 3197 m_loadState = WaitingForSource; |
| 3210 | 3198 |
| 3211 // We can't cast if we don't have a media player. | 3199 // We can't cast if we don't have a media player. |
| 3212 m_remoteRoutesAvailable = false; | 3200 m_remoteRoutesAvailable = false; |
| 3213 m_playingRemotely = false; | 3201 m_playingRemotely = false; |
| 3214 if (mediaControls()) | 3202 if (mediaControls()) |
| 3215 mediaControls()->refreshCastButtonVisibilityWithoutUpdate(); | 3203 mediaControls()->refreshCastButtonVisibilityWithoutUpdate(); |
| 3216 | 3204 |
| 3217 if (layoutObject()) | 3205 if (layoutObject()) |
| 3218 layoutObject()->setShouldDoFullPaintInvalidation(); | 3206 layoutObject()->setShouldDoFullPaintInvalidation(); |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4022 | 4010 |
| 4023 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst | 4011 IntRect HTMLMediaElement::AutoplayHelperClientImpl::absoluteBoundingBoxRect() co nst |
| 4024 { | 4012 { |
| 4025 IntRect result; | 4013 IntRect result; |
| 4026 if (LayoutObject* object = m_element->layoutObject()) | 4014 if (LayoutObject* object = m_element->layoutObject()) |
| 4027 result = object->absoluteBoundingBoxRect(); | 4015 result = object->absoluteBoundingBoxRect(); |
| 4028 return result; | 4016 return result; |
| 4029 } | 4017 } |
| 4030 | 4018 |
| 4031 } // namespace blink | 4019 } // namespace blink |
| OLD | NEW |