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

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

Issue 1228293003: Return early in automaticTrackSelectionForUpdatedUserPreference() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3261 matching lines...) Expand 10 before | Expand all | Expand 10 after
3272 3272
3273 void HTMLMediaElement::setTextTrackKindUserPreferenceForAllMediaElements(Documen t* document) 3273 void HTMLMediaElement::setTextTrackKindUserPreferenceForAllMediaElements(Documen t* document)
3274 { 3274 {
3275 WeakMediaElementSet elements = documentToElementSetMap().get(document); 3275 WeakMediaElementSet elements = documentToElementSetMap().get(document);
3276 for (const auto& element : elements) 3276 for (const auto& element : elements)
3277 element->automaticTrackSelectionForUpdatedUserPreference(); 3277 element->automaticTrackSelectionForUpdatedUserPreference();
3278 } 3278 }
3279 3279
3280 void HTMLMediaElement::automaticTrackSelectionForUpdatedUserPreference() 3280 void HTMLMediaElement::automaticTrackSelectionForUpdatedUserPreference()
3281 { 3281 {
3282 if (!m_textTracks || !m_textTracks->length())
3283 return;
3284
3282 markCaptionAndSubtitleTracksAsUnconfigured(); 3285 markCaptionAndSubtitleTracksAsUnconfigured();
3283 m_processingPreferenceChange = true; 3286 m_processingPreferenceChange = true;
3284 m_closedCaptionsVisible = false; 3287 m_closedCaptionsVisible = false;
3285 honorUserPreferencesForAutomaticTextTrackSelection(); 3288 honorUserPreferencesForAutomaticTextTrackSelection();
3286 m_processingPreferenceChange = false; 3289 m_processingPreferenceChange = false;
3287 3290
3288 // If a track is set to 'showing' post performing automatic track selection, 3291 // If a track is set to 'showing' post performing automatic track selection,
3289 // set closed captions state to visible to update the CC button and display the track. 3292 // set closed captions state to visible to update the CC button and display the track.
3290 if (m_textTracks) 3293 m_closedCaptionsVisible = m_textTracks->hasShowingTracks();
3291 m_closedCaptionsVisible = m_textTracks->hasShowingTracks();
3292 updateTextTrackDisplay(); 3294 updateTextTrackDisplay();
3293 } 3295 }
3294 3296
3295 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured() 3297 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
3296 { 3298 {
3297 if (!m_textTracks) 3299 if (!m_textTracks)
3298 return; 3300 return;
3299 3301
3300 // Mark all tracks as not "configured" so that 3302 // Mark all tracks as not "configured" so that
3301 // honorUserPreferencesForAutomaticTextTrackSelection() will reconsider 3303 // honorUserPreferencesForAutomaticTextTrackSelection() will reconsider
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
3688 3690
3689 #if ENABLE(WEB_AUDIO) 3691 #if ENABLE(WEB_AUDIO)
3690 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3692 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3691 { 3693 {
3692 if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider()) 3694 if (!Heap::isHeapObjectAlive(m_audioSourceNode) && audioSourceProvider())
3693 audioSourceProvider()->setClient(nullptr); 3695 audioSourceProvider()->setClient(nullptr);
3694 } 3696 }
3695 #endif 3697 #endif
3696 3698
3697 } 3699 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698