| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 | 876 |
| 877 void HTMLMediaElement::loadInternal() { | 877 void HTMLMediaElement::loadInternal() { |
| 878 // HTMLMediaElement::textTracksAreReady will need "... the text tracks whose | 878 // HTMLMediaElement::textTracksAreReady will need "... the text tracks whose |
| 879 // mode was not in the disabled state when the element's resource selection | 879 // mode was not in the disabled state when the element's resource selection |
| 880 // algorithm last started". | 880 // algorithm last started". |
| 881 m_textTracksWhenResourceSelectionBegan.clear(); | 881 m_textTracksWhenResourceSelectionBegan.clear(); |
| 882 if (m_textTracks) { | 882 if (m_textTracks) { |
| 883 for (unsigned i = 0; i < m_textTracks->length(); ++i) { | 883 for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
| 884 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); | 884 TextTrack* track = m_textTracks->anonymousIndexedGetter(i); |
| 885 if (track->mode() != TextTrack::disabledKeyword()) | 885 if (track->mode() != TextTrack::disabledKeyword()) |
| 886 m_textTracksWhenResourceSelectionBegan.append(track); | 886 m_textTracksWhenResourceSelectionBegan.push_back(track); |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 | 889 |
| 890 selectMediaResource(); | 890 selectMediaResource(); |
| 891 } | 891 } |
| 892 | 892 |
| 893 void HTMLMediaElement::selectMediaResource() { | 893 void HTMLMediaElement::selectMediaResource() { |
| 894 BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this << ")"; | 894 BLINK_MEDIA_LOG << "selectMediaResource(" << (void*)this << ")"; |
| 895 | 895 |
| 896 enum Mode { Object, Attribute, Children, Nothing }; | 896 enum Mode { Object, Attribute, Children, Nothing }; |
| (...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2160 } | 2160 } |
| 2161 | 2161 |
| 2162 ScriptPromise HTMLMediaElement::playForBindings(ScriptState* scriptState) { | 2162 ScriptPromise HTMLMediaElement::playForBindings(ScriptState* scriptState) { |
| 2163 // We have to share the same logic for internal and external callers. The | 2163 // We have to share the same logic for internal and external callers. The |
| 2164 // internal callers do not want to receive a Promise back but when ::play() | 2164 // internal callers do not want to receive a Promise back but when ::play() |
| 2165 // is called, |m_playPromiseResolvers| needs to be populated. What this code | 2165 // is called, |m_playPromiseResolvers| needs to be populated. What this code |
| 2166 // does is to populate |m_playPromiseResolvers| before calling ::play() and | 2166 // does is to populate |m_playPromiseResolvers| before calling ::play() and |
| 2167 // remove the Promise if ::play() failed. | 2167 // remove the Promise if ::play() failed. |
| 2168 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); | 2168 ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
| 2169 ScriptPromise promise = resolver->promise(); | 2169 ScriptPromise promise = resolver->promise(); |
| 2170 m_playPromiseResolvers.append(resolver); | 2170 m_playPromiseResolvers.push_back(resolver); |
| 2171 | 2171 |
| 2172 Nullable<ExceptionCode> code = play(); | 2172 Nullable<ExceptionCode> code = play(); |
| 2173 if (!code.isNull()) { | 2173 if (!code.isNull()) { |
| 2174 DCHECK(!m_playPromiseResolvers.isEmpty()); | 2174 DCHECK(!m_playPromiseResolvers.isEmpty()); |
| 2175 m_playPromiseResolvers.pop_back(); | 2175 m_playPromiseResolvers.pop_back(); |
| 2176 | 2176 |
| 2177 String message; | 2177 String message; |
| 2178 switch (code.get()) { | 2178 switch (code.get()) { |
| 2179 case NotAllowedError: | 2179 case NotAllowedError: |
| 2180 message = "play() can only be initiated by a user gesture."; | 2180 message = "play() can only be initiated by a user gesture."; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2530 | 2530 |
| 2531 if (!m_audioTracksTimer.isActive()) | 2531 if (!m_audioTracksTimer.isActive()) |
| 2532 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); | 2532 m_audioTracksTimer.startOneShot(0, BLINK_FROM_HERE); |
| 2533 } | 2533 } |
| 2534 | 2534 |
| 2535 void HTMLMediaElement::audioTracksTimerFired(TimerBase*) { | 2535 void HTMLMediaElement::audioTracksTimerFired(TimerBase*) { |
| 2536 Vector<WebMediaPlayer::TrackId> enabledTrackIds; | 2536 Vector<WebMediaPlayer::TrackId> enabledTrackIds; |
| 2537 for (unsigned i = 0; i < audioTracks().length(); ++i) { | 2537 for (unsigned i = 0; i < audioTracks().length(); ++i) { |
| 2538 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); | 2538 AudioTrack* track = audioTracks().anonymousIndexedGetter(i); |
| 2539 if (track->enabled()) | 2539 if (track->enabled()) |
| 2540 enabledTrackIds.append(track->id()); | 2540 enabledTrackIds.push_back(track->id()); |
| 2541 } | 2541 } |
| 2542 | 2542 |
| 2543 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); | 2543 webMediaPlayer()->enabledAudioTracksChanged(enabledTrackIds); |
| 2544 } | 2544 } |
| 2545 | 2545 |
| 2546 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack( | 2546 WebMediaPlayer::TrackId HTMLMediaElement::addAudioTrack( |
| 2547 const WebString& id, | 2547 const WebString& id, |
| 2548 WebMediaPlayerClient::AudioTrackKind kind, | 2548 WebMediaPlayerClient::AudioTrackKind kind, |
| 2549 const WebString& label, | 2549 const WebString& label, |
| 2550 const WebString& language, | 2550 const WebString& language, |
| (...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4103 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); | 4103 kMostlyFillViewportBecomeStableSeconds, BLINK_FROM_HERE); |
| 4104 } | 4104 } |
| 4105 | 4105 |
| 4106 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { | 4106 void HTMLMediaElement::viewportFillDebouncerTimerFired(TimerBase*) { |
| 4107 m_mostlyFillingViewport = true; | 4107 m_mostlyFillingViewport = true; |
| 4108 if (m_webMediaPlayer) | 4108 if (m_webMediaPlayer) |
| 4109 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); | 4109 m_webMediaPlayer->becameDominantVisibleContent(m_mostlyFillingViewport); |
| 4110 } | 4110 } |
| 4111 | 4111 |
| 4112 } // namespace blink | 4112 } // namespace blink |
| OLD | NEW |