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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.h

Issue 1810513002: Media element resource selection algorithm should "await a stable state" Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use CancellableTaskFactory Created 4 years, 8 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlayerClient ::VideoTrackKind, const WebString&, const WebString&, bool) final; 324 WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlayerClient ::VideoTrackKind, const WebString&, const WebString&, bool) final;
325 void removeVideoTrack(WebMediaPlayer::TrackId) final; 325 void removeVideoTrack(WebMediaPlayer::TrackId) final;
326 void addTextTrack(WebInbandTextTrack*) final; 326 void addTextTrack(WebInbandTextTrack*) final;
327 void removeTextTrack(WebInbandTextTrack*) final; 327 void removeTextTrack(WebInbandTextTrack*) final;
328 void mediaSourceOpened(WebMediaSource*) final; 328 void mediaSourceOpened(WebMediaSource*) final;
329 void requestSeek(double) final; 329 void requestSeek(double) final;
330 void remoteRouteAvailabilityChanged(bool) final; 330 void remoteRouteAvailabilityChanged(bool) final;
331 void connectedToRemoteDevice() final; 331 void connectedToRemoteDevice() final;
332 void disconnectedFromRemoteDevice() final; 332 void disconnectedFromRemoteDevice() final;
333 333
334 void loadTimerFired(Timer<HTMLMediaElement>*); 334 void textTrackLoadTimerFired(Timer<HTMLMediaElement>*);
335 void progressEventTimerFired(Timer<HTMLMediaElement>*); 335 void progressEventTimerFired(Timer<HTMLMediaElement>*);
336 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); 336 void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
337 void startPlaybackProgressTimer(); 337 void startPlaybackProgressTimer();
338 void startProgressEventTimer(); 338 void startProgressEventTimer();
339 void stopPeriodicTimers(); 339 void stopPeriodicTimers();
340 340
341 void seek(double time); 341 void seek(double time);
342 void finishSeek(); 342 void finishSeek();
343 void checkIfSeekNeeded(); 343 void checkIfSeekNeeded();
344 void addPlayedRange(double start, double end); 344 void addPlayedRange(double start, double end);
345 345
346 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity. 346 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity.
347 347
348 // loading 348 // loading
349 void invokeLoadAlgorithm(); 349 void invokeLoadAlgorithm();
350 void invokeResourceSelectionAlgorithm(); 350 void invokeResourceSelectionAlgorithm();
351 void continueResourceSelectionAlgorithm();
352 void enqueueMicrotaskForResourceSelectionAlgorithmContinuation();
351 void loadInternal(); 353 void loadInternal();
352 void selectMediaResource(); 354 void selectMediaResource();
353 void loadResource(const KURL&, ContentType&); 355 void loadResource(const KURL&, ContentType&);
354 void startPlayerLoad(); 356 void startPlayerLoad();
355 void setPlayerPreload(); 357 void setPlayerPreload();
356 WebMediaPlayer::LoadType loadType() const; 358 WebMediaPlayer::LoadType loadType() const;
357 void scheduleNextSourceChild();
358 void loadNextSourceChild(); 359 void loadNextSourceChild();
359 void clearMediaPlayer(); 360 void clearMediaPlayer();
360 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 361 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
361 bool havePotentialSourceChild(); 362 bool havePotentialSourceChild();
362 void noneSupported(); 363 void noneSupported();
363 void mediaEngineError(MediaError*); 364 void mediaEngineError(MediaError*);
364 void cancelPendingEventsAndCallbacks(); 365 void cancelPendingEventsAndCallbacks();
365 void waitForSourceChange(); 366 void waitForSourceChange();
366 void setIgnorePreloadNone(); 367 void setIgnorePreloadNone();
367 368
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 void scheduleResolvePlayPromises(); 459 void scheduleResolvePlayPromises();
459 void scheduleRejectPlayPromises(ExceptionCode); 460 void scheduleRejectPlayPromises(ExceptionCode);
460 void scheduleNotifyPlaying(); 461 void scheduleNotifyPlaying();
461 462
462 void resolvePlayPromises(); 463 void resolvePlayPromises();
463 // TODO(mlamouri): this is used for cancellable tasks because we can't pass 464 // TODO(mlamouri): this is used for cancellable tasks because we can't pass
464 // parameters. 465 // parameters.
465 void rejectPlayPromises(); 466 void rejectPlayPromises();
466 void rejectPlayPromises(ExceptionCode, const String&); 467 void rejectPlayPromises(ExceptionCode, const String&);
467 468
468 UnthrottledTimer<HTMLMediaElement> m_loadTimer; 469 UnthrottledTimer<HTMLMediaElement> m_textTrackLoadTimer;
469 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; 470 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer;
470 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; 471 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer;
471 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; 472 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer;
472 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; 473 PersistentWillBeMember<TimeRanges> m_playedTimeRanges;
473 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; 474 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
474 475
475 double m_playbackRate; 476 double m_playbackRate;
476 double m_defaultPlaybackRate; 477 double m_defaultPlaybackRate;
477 NetworkState m_networkState; 478 NetworkState m_networkState;
478 ReadyState m_readyState; 479 ReadyState m_readyState;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 DisplayMode m_displayMode; 527 DisplayMode m_displayMode;
527 528
528 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; 529 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource;
529 530
530 // Cached time value. Only valid when ready state is HAVE_METADATA or 531 // Cached time value. Only valid when ready state is HAVE_METADATA or
531 // higher, otherwise the current time is assumed to be zero. 532 // higher, otherwise the current time is assumed to be zero.
532 mutable double m_cachedTime; 533 mutable double m_cachedTime;
533 534
534 double m_fragmentEndTime; 535 double m_fragmentEndTime;
535 536
536 typedef unsigned PendingActionFlags;
537 PendingActionFlags m_pendingActionFlags;
538
539 // FIXME: HTMLMediaElement has way too many state bits. 537 // FIXME: HTMLMediaElement has way too many state bits.
540 bool m_userGestureRequiredForPlay : 1; 538 bool m_userGestureRequiredForPlay : 1;
541 bool m_playing : 1; 539 bool m_playing : 1;
542 bool m_shouldDelayLoadEvent : 1; 540 bool m_shouldDelayLoadEvent : 1;
543 bool m_haveFiredLoadedData : 1; 541 bool m_haveFiredLoadedData : 1;
544 bool m_autoplaying : 1; 542 bool m_autoplaying : 1;
545 bool m_muted : 1; 543 bool m_muted : 1;
546 bool m_paused : 1; 544 bool m_paused : 1;
547 bool m_seeking : 1; 545 bool m_seeking : 1;
548 546
(...skipping 21 matching lines...) Expand all
570 PersistentWillBeMember<TextTrackList> m_textTracks; 568 PersistentWillBeMember<TextTrackList> m_textTracks;
571 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso urceSelectionBegan; 569 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso urceSelectionBegan;
572 570
573 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; 571 OwnPtrWillBeMember<CueTimeline> m_cueTimeline;
574 572
575 PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playRe solvers; 573 PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playRe solvers;
576 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; 574 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask;
577 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; 575 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask;
578 ExceptionCode m_playPromiseErrorCode; 576 ExceptionCode m_playPromiseErrorCode;
579 577
578 OwnPtr<CancellableTaskFactory> m_resourceSelectionAlgorithmContinuationTask;
579
580 // This is a weak reference, since m_audioSourceNode holds a reference to us . 580 // This is a weak reference, since m_audioSourceNode holds a reference to us .
581 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. 581 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem.
582 GC_PLUGIN_IGNORE("http://crbug.com/404577") 582 GC_PLUGIN_IGNORE("http://crbug.com/404577")
583 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; 583 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode;
584 584
585 // AudioClientImpl wraps an AudioSourceProviderClient. 585 // AudioClientImpl wraps an AudioSourceProviderClient.
586 // When the audio format is known, Chromium calls setFormat(). 586 // When the audio format is known, Chromium calls setFormat().
587 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient { 587 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient {
588 public: 588 public:
589 explicit AudioClientImpl(AudioSourceProviderClient* client) 589 explicit AudioClientImpl(AudioSourceProviderClient* client)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 inline bool isHTMLMediaElement(const HTMLElement& element) 644 inline bool isHTMLMediaElement(const HTMLElement& element)
645 { 645 {
646 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 646 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
647 } 647 }
648 648
649 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 649 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
650 650
651 } // namespace blink 651 } // namespace blink
652 652
653 #endif // HTMLMediaElement_h 653 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698