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

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: Rebase and address review comments 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 void removeVideoTrack(WebMediaPlayer::TrackId) final; 340 void removeVideoTrack(WebMediaPlayer::TrackId) final;
341 void addTextTrack(WebInbandTextTrack*) final; 341 void addTextTrack(WebInbandTextTrack*) final;
342 void removeTextTrack(WebInbandTextTrack*) final; 342 void removeTextTrack(WebInbandTextTrack*) final;
343 void mediaSourceOpened(WebMediaSource*) final; 343 void mediaSourceOpened(WebMediaSource*) final;
344 void requestSeek(double) final; 344 void requestSeek(double) final;
345 void remoteRouteAvailabilityChanged(bool) final; 345 void remoteRouteAvailabilityChanged(bool) final;
346 void connectedToRemoteDevice() final; 346 void connectedToRemoteDevice() final;
347 void disconnectedFromRemoteDevice() final; 347 void disconnectedFromRemoteDevice() final;
348 void cancelledRemotePlaybackRequest() final; 348 void cancelledRemotePlaybackRequest() final;
349 349
350 void loadTimerFired(Timer<HTMLMediaElement>*); 350 void textTrackLoadTimerFired(Timer<HTMLMediaElement>*);
351 void progressEventTimerFired(Timer<HTMLMediaElement>*); 351 void progressEventTimerFired(Timer<HTMLMediaElement>*);
352 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); 352 void playbackProgressTimerFired(Timer<HTMLMediaElement>*);
353 void startPlaybackProgressTimer(); 353 void startPlaybackProgressTimer();
354 void startProgressEventTimer(); 354 void startProgressEventTimer();
355 void stopPeriodicTimers(); 355 void stopPeriodicTimers();
356 356
357 void seek(double time); 357 void seek(double time);
358 void finishSeek(); 358 void finishSeek();
359 void checkIfSeekNeeded(); 359 void checkIfSeekNeeded();
360 void addPlayedRange(double start, double end); 360 void addPlayedRange(double start, double end);
361 361
362 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity. 362 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity.
363 363
364 // loading 364 // loading
365 void invokeLoadAlgorithm(); 365 void invokeLoadAlgorithm();
366 void invokeResourceSelectionAlgorithm(); 366 void invokeResourceSelectionAlgorithm();
367 void continueResourceSelectionAlgorithm();
368 void enqueueMicrotaskForResourceSelectionAlgorithmContinuation();
367 void loadInternal(); 369 void loadInternal();
368 void selectMediaResource(); 370 void selectMediaResource();
369 void loadResource(const KURL&, ContentType&); 371 void loadResource(const KURL&, ContentType&);
370 void startPlayerLoad(); 372 void startPlayerLoad();
371 void setPlayerPreload(); 373 void setPlayerPreload();
372 WebMediaPlayer::LoadType loadType() const; 374 WebMediaPlayer::LoadType loadType() const;
373 void scheduleNextSourceChild();
374 void loadNextSourceChild(); 375 void loadNextSourceChild();
376 void loadNextSourceChildOnError();
375 void clearMediaPlayer(); 377 void clearMediaPlayer();
376 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 378 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
377 bool havePotentialSourceChild(); 379 bool havePotentialSourceChild();
378 void noneSupported(); 380 void noneSupported();
379 void mediaEngineError(MediaError*); 381 void mediaEngineError(MediaError*);
380 void cancelPendingEventsAndCallbacks(); 382 void cancelPendingEventsAndCallbacks();
381 void waitForSourceChange(); 383 void waitForSourceChange();
382 void setIgnorePreloadNone(); 384 void setIgnorePreloadNone();
383 385
384 KURL selectNextSourceChild(ContentType*, InvalidURLAction); 386 KURL selectNextSourceChild(ContentType*, InvalidURLAction);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 void scheduleResolvePlayPromises(); 469 void scheduleResolvePlayPromises();
468 void scheduleRejectPlayPromises(ExceptionCode); 470 void scheduleRejectPlayPromises(ExceptionCode);
469 void scheduleNotifyPlaying(); 471 void scheduleNotifyPlaying();
470 472
471 void resolvePlayPromises(); 473 void resolvePlayPromises();
472 // TODO(mlamouri): this is used for cancellable tasks because we can't pass 474 // TODO(mlamouri): this is used for cancellable tasks because we can't pass
473 // parameters. 475 // parameters.
474 void rejectPlayPromises(); 476 void rejectPlayPromises();
475 void rejectPlayPromises(ExceptionCode, const String&); 477 void rejectPlayPromises(ExceptionCode, const String&);
476 478
477 UnthrottledTimer<HTMLMediaElement> m_loadTimer; 479 UnthrottledTimer<HTMLMediaElement> m_textTrackLoadTimer;
478 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; 480 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer;
479 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; 481 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer;
480 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; 482 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer;
481 Member<TimeRanges> m_playedTimeRanges; 483 Member<TimeRanges> m_playedTimeRanges;
482 Member<GenericEventQueue> m_asyncEventQueue; 484 Member<GenericEventQueue> m_asyncEventQueue;
483 485
484 double m_playbackRate; 486 double m_playbackRate;
485 double m_defaultPlaybackRate; 487 double m_defaultPlaybackRate;
486 NetworkState m_networkState; 488 NetworkState m_networkState;
487 ReadyState m_readyState; 489 ReadyState m_readyState;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 DisplayMode m_displayMode; 537 DisplayMode m_displayMode;
536 538
537 Member<HTMLMediaSource> m_mediaSource; 539 Member<HTMLMediaSource> m_mediaSource;
538 540
539 // Cached time value. Only valid when ready state is HAVE_METADATA or 541 // Cached time value. Only valid when ready state is HAVE_METADATA or
540 // higher, otherwise the current time is assumed to be zero. 542 // higher, otherwise the current time is assumed to be zero.
541 mutable double m_cachedTime; 543 mutable double m_cachedTime;
542 544
543 double m_fragmentEndTime; 545 double m_fragmentEndTime;
544 546
545 typedef unsigned PendingActionFlags;
546 PendingActionFlags m_pendingActionFlags;
547
548 // FIXME: HTMLMediaElement has way too many state bits. 547 // FIXME: HTMLMediaElement has way too many state bits.
549 bool m_userGestureRequiredForPlay : 1; 548 bool m_userGestureRequiredForPlay : 1;
550 bool m_playing : 1; 549 bool m_playing : 1;
551 bool m_shouldDelayLoadEvent : 1; 550 bool m_shouldDelayLoadEvent : 1;
552 bool m_haveFiredLoadedData : 1; 551 bool m_haveFiredLoadedData : 1;
553 bool m_autoplaying : 1; 552 bool m_autoplaying : 1;
554 bool m_muted : 1; 553 bool m_muted : 1;
555 bool m_paused : 1; 554 bool m_paused : 1;
556 bool m_seeking : 1; 555 bool m_seeking : 1;
557 556
(...skipping 19 matching lines...) Expand all
577 Member<TextTrackList> m_textTracks; 576 Member<TextTrackList> m_textTracks;
578 HeapVector<Member<TextTrack>> m_textTracksWhenResourceSelectionBegan; 577 HeapVector<Member<TextTrack>> m_textTracksWhenResourceSelectionBegan;
579 578
580 Member<CueTimeline> m_cueTimeline; 579 Member<CueTimeline> m_cueTimeline;
581 580
582 HeapVector<Member<ScriptPromiseResolver>> m_playResolvers; 581 HeapVector<Member<ScriptPromiseResolver>> m_playResolvers;
583 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; 582 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask;
584 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; 583 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask;
585 ExceptionCode m_playPromiseErrorCode; 584 ExceptionCode m_playPromiseErrorCode;
586 585
586 OwnPtr<CancellableTaskFactory> m_resourceSelectionAlgorithmContinuationTask;
587 OwnPtr<CancellableTaskFactory> m_loadNextSourceChildOnErrorTask;
588
587 // This is a weak reference, since m_audioSourceNode holds a reference to us . 589 // This is a weak reference, since m_audioSourceNode holds a reference to us .
588 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. 590 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem.
589 GC_PLUGIN_IGNORE("http://crbug.com/404577") 591 GC_PLUGIN_IGNORE("http://crbug.com/404577")
590 WeakMember<AudioSourceProviderClient> m_audioSourceNode; 592 WeakMember<AudioSourceProviderClient> m_audioSourceNode;
591 593
592 // AudioClientImpl wraps an AudioSourceProviderClient. 594 // AudioClientImpl wraps an AudioSourceProviderClient.
593 // When the audio format is known, Chromium calls setFormat(). 595 // When the audio format is known, Chromium calls setFormat().
594 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient { 596 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient {
595 public: 597 public:
596 explicit AudioClientImpl(AudioSourceProviderClient* client) 598 explicit AudioClientImpl(AudioSourceProviderClient* client)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 inline bool isHTMLMediaElement(const HTMLElement& element) 662 inline bool isHTMLMediaElement(const HTMLElement& element)
661 { 663 {
662 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 664 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
663 } 665 }
664 666
665 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 667 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
666 668
667 } // namespace blink 669 } // namespace blink
668 670
669 #endif // HTMLMediaElement_h 671 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698