Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 318923004: Eliminate MediaPlayer & MediaPlayerClient abstractions(readystate) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed review comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 if (m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextT rack::Loading 1225 if (m_textTracksWhenResourceSelectionBegan[i]->readinessState() == TextT rack::Loading
1226 || m_textTracksWhenResourceSelectionBegan[i]->readinessState() == Te xtTrack::NotLoaded) 1226 || m_textTracksWhenResourceSelectionBegan[i]->readinessState() == Te xtTrack::NotLoaded)
1227 return false; 1227 return false;
1228 } 1228 }
1229 1229
1230 return true; 1230 return true;
1231 } 1231 }
1232 1232
1233 void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track) 1233 void HTMLMediaElement::textTrackReadyStateChanged(TextTrack* track)
1234 { 1234 {
1235 if (m_player && m_textTracksWhenResourceSelectionBegan.contains(track)) { 1235 if (webMediaPlayer()&& m_textTracksWhenResourceSelectionBegan.contains(track )) {
1236 if (track->readinessState() != TextTrack::Loading) 1236 if (track->readinessState() != TextTrack::Loading)
1237 setReadyState(m_player->readyState()); 1237 setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState() ));
1238 } else { 1238 } else {
1239 // The track readiness state might have changed as a result of the user 1239 // The track readiness state might have changed as a result of the user
1240 // clicking the captions button. In this case, a check whether all the 1240 // clicking the captions button. In this case, a check whether all the
1241 // resources have failed loading should be done in order to hide the CC button. 1241 // resources have failed loading should be done in order to hide the CC button.
1242 if (hasMediaControls() && track->readinessState() == TextTrack::FailedTo Load) 1242 if (hasMediaControls() && track->readinessState() == TextTrack::FailedTo Load)
1243 mediaControls()->refreshClosedCaptionsButtonVisibility(); 1243 mediaControls()->refreshClosedCaptionsButtonVisibility();
1244 } 1244 }
1245 } 1245 }
1246 1246
1247 void HTMLMediaElement::textTrackModeChanged(TextTrack* track) 1247 void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 1579
1580 // Schedule one last progress event so we guarantee that at least one is fir ed 1580 // Schedule one last progress event so we guarantee that at least one is fir ed
1581 // for files that load very quickly. 1581 // for files that load very quickly.
1582 scheduleEvent(EventTypeNames::progress); 1582 scheduleEvent(EventTypeNames::progress);
1583 scheduleEvent(EventTypeNames::suspend); 1583 scheduleEvent(EventTypeNames::suspend);
1584 m_networkState = NETWORK_IDLE; 1584 m_networkState = NETWORK_IDLE;
1585 } 1585 }
1586 1586
1587 void HTMLMediaElement::mediaPlayerReadyStateChanged() 1587 void HTMLMediaElement::mediaPlayerReadyStateChanged()
1588 { 1588 {
1589 setReadyState(m_player->readyState()); 1589 setReadyState(static_cast<ReadyState>(webMediaPlayer()->readyState()));
1590 } 1590 }
1591 1591
1592 void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) 1592 void HTMLMediaElement::setReadyState(ReadyState state)
1593 { 1593 {
1594 WTF_LOG(Media, "HTMLMediaElement::setReadyState(%d) - current state is %d,", static_cast<int>(state), static_cast<int>(m_readyState)); 1594 WTF_LOG(Media, "HTMLMediaElement::setReadyState(%d) - current state is %d,", static_cast<int>(state), static_cast<int>(m_readyState));
1595 1595
1596 // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlay ing() uses it 1596 // Set "wasPotentiallyPlaying" BEFORE updating m_readyState, potentiallyPlay ing() uses it
1597 bool wasPotentiallyPlaying = potentiallyPlaying(); 1597 bool wasPotentiallyPlaying = potentiallyPlaying();
1598 1598
1599 ReadyState oldState = m_readyState; 1599 ReadyState oldState = m_readyState;
1600 ReadyState newState = static_cast<ReadyState>(state); 1600 ReadyState newState = state;
1601 1601
1602 bool tracksAreReady = textTracksAreReady(); 1602 bool tracksAreReady = textTracksAreReady();
1603 1603
1604 if (newState == oldState && m_tracksAreReady == tracksAreReady) 1604 if (newState == oldState && m_tracksAreReady == tracksAreReady)
1605 return; 1605 return;
1606 1606
1607 m_tracksAreReady = tracksAreReady; 1607 m_tracksAreReady = tracksAreReady;
1608 1608
1609 if (tracksAreReady) 1609 if (tracksAreReady)
1610 m_readyState = newState; 1610 m_readyState = newState;
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after
3655 visitor->trace(m_error); 3655 visitor->trace(m_error);
3656 visitor->trace(m_currentSourceNode); 3656 visitor->trace(m_currentSourceNode);
3657 visitor->trace(m_nextChildNodeToConsider); 3657 visitor->trace(m_nextChildNodeToConsider);
3658 visitor->trace(m_textTracks); 3658 visitor->trace(m_textTracks);
3659 visitor->trace(m_textTracksWhenResourceSelectionBegan); 3659 visitor->trace(m_textTracksWhenResourceSelectionBegan);
3660 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor); 3660 WillBeHeapSupplementable<HTMLMediaElement>::trace(visitor);
3661 HTMLElement::trace(visitor); 3661 HTMLElement::trace(visitor);
3662 } 3662 }
3663 3663
3664 } 3664 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMediaElement.h ('k') | Source/modules/imagebitmap/ImageBitmapFactories.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698