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

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 microtask changes Created 4 years, 3 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 void addTextTrack(WebInbandTextTrack*) final; 345 void addTextTrack(WebInbandTextTrack*) final;
346 void removeTextTrack(WebInbandTextTrack*) final; 346 void removeTextTrack(WebInbandTextTrack*) final;
347 void mediaSourceOpened(WebMediaSource*) final; 347 void mediaSourceOpened(WebMediaSource*) final;
348 void requestSeek(double) final; 348 void requestSeek(double) final;
349 void remoteRouteAvailabilityChanged(bool) final; 349 void remoteRouteAvailabilityChanged(bool) final;
350 void connectedToRemoteDevice() final; 350 void connectedToRemoteDevice() final;
351 void disconnectedFromRemoteDevice() final; 351 void disconnectedFromRemoteDevice() final;
352 void cancelledRemotePlaybackRequest() final; 352 void cancelledRemotePlaybackRequest() final;
353 void requestReload(const WebURL&) final; 353 void requestReload(const WebURL&) final;
354 354
355 void loadTimerFired(TimerBase*); 355 void textTrackLoadTimerFired(TimerBase*);
356 void progressEventTimerFired(TimerBase*); 356 void progressEventTimerFired(TimerBase*);
357 void playbackProgressTimerFired(TimerBase*); 357 void playbackProgressTimerFired(TimerBase*);
358 void startPlaybackProgressTimer(); 358 void startPlaybackProgressTimer();
359 void startProgressEventTimer(); 359 void startProgressEventTimer();
360 void stopPeriodicTimers(); 360 void stopPeriodicTimers();
361 361
362 void seek(double time); 362 void seek(double time);
363 void finishSeek(); 363 void finishSeek();
364 void checkIfSeekNeeded(); 364 void checkIfSeekNeeded();
365 void addPlayedRange(double start, double end); 365 void addPlayedRange(double start, double end);
366 366
367 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity. 367 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity.
368 368
369 // loading 369 // loading
370 void invokeLoadAlgorithm(); 370 void invokeLoadAlgorithm();
371 void invokeResourceSelectionAlgorithm(); 371 void invokeResourceSelectionAlgorithm();
372 void continueResourceSelectionAlgorithm();
372 void loadInternal(); 373 void loadInternal();
373 void selectMediaResource(); 374 void selectMediaResource();
374 void loadResource(const WebMediaPlayerSource&, const ContentType&); 375 void loadResource(const WebMediaPlayerSource&, const ContentType&);
375 void startPlayerLoad(const KURL& playerProvidedUrl = KURL()); 376 void startPlayerLoad(const KURL& playerProvidedUrl = KURL());
376 void setPlayerPreload(); 377 void setPlayerPreload();
377 WebMediaPlayer::LoadType loadType() const; 378 WebMediaPlayer::LoadType loadType() const;
378 void scheduleNextSourceChild(); 379 void scheduleNextSourceChild();
379 void loadSourceFromObject(); 380 void loadSourceFromObject();
380 void loadSourceFromAttribute(); 381 void loadSourceFromAttribute();
381 void loadNextSourceChild(); 382 void loadNextSourceChild();
383 void loadNextSourceChildAfterError();
382 void clearMediaPlayer(); 384 void clearMediaPlayer();
383 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 385 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
384 bool havePotentialSourceChild(); 386 bool havePotentialSourceChild();
385 void noneSupported(); 387 void noneSupported();
386 void mediaEngineError(MediaError*); 388 void mediaEngineError(MediaError*);
387 void cancelPendingEventsAndCallbacks(); 389 void cancelPendingEventsAndCallbacks();
388 void waitForSourceChange(); 390 void waitForSourceChange();
389 void setIgnorePreloadNone(); 391 void setIgnorePreloadNone();
390 392
391 KURL selectNextSourceChild(ContentType*, InvalidURLAction); 393 KURL selectNextSourceChild(ContentType*, InvalidURLAction);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 void scheduleNotifyPlaying(); 490 void scheduleNotifyPlaying();
489 void resolveScheduledPlayPromises(); 491 void resolveScheduledPlayPromises();
490 void rejectScheduledPlayPromises(); 492 void rejectScheduledPlayPromises();
491 void rejectPlayPromises(ExceptionCode, const String&); 493 void rejectPlayPromises(ExceptionCode, const String&);
492 void rejectPlayPromisesInternal(ExceptionCode, const String&); 494 void rejectPlayPromisesInternal(ExceptionCode, const String&);
493 495
494 EnumerationHistogram& showControlsHistogram() const; 496 EnumerationHistogram& showControlsHistogram() const;
495 497
496 void onVisibilityChangedForAutoplay(bool isVisible); 498 void onVisibilityChangedForAutoplay(bool isVisible);
497 499
498 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; 500 UnthrottledThreadTimer<HTMLMediaElement> m_textTrackLoadTimer;
499 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; 501 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer;
500 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; 502 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer;
501 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; 503 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer;
502 Member<TimeRanges> m_playedTimeRanges; 504 Member<TimeRanges> m_playedTimeRanges;
503 Member<GenericEventQueue> m_asyncEventQueue; 505 Member<GenericEventQueue> m_asyncEventQueue;
504 506
505 double m_playbackRate; 507 double m_playbackRate;
506 double m_defaultPlaybackRate; 508 double m_defaultPlaybackRate;
507 NetworkState m_networkState; 509 NetworkState m_networkState;
508 ReadyState m_readyState; 510 ReadyState m_readyState;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 DisplayMode m_displayMode; 559 DisplayMode m_displayMode;
558 560
559 Member<HTMLMediaSource> m_mediaSource; 561 Member<HTMLMediaSource> m_mediaSource;
560 562
561 // Cached time value. Only valid when ready state is kHaveMetadata or 563 // Cached time value. Only valid when ready state is kHaveMetadata or
562 // higher, otherwise the current time is assumed to be zero. 564 // higher, otherwise the current time is assumed to be zero.
563 mutable double m_cachedTime; 565 mutable double m_cachedTime;
564 566
565 double m_fragmentEndTime; 567 double m_fragmentEndTime;
566 568
567 typedef unsigned PendingActionFlags;
568 PendingActionFlags m_pendingActionFlags;
569
570 // FIXME: HTMLMediaElement has way too many state bits. 569 // FIXME: HTMLMediaElement has way too many state bits.
571 bool m_lockedPendingUserGesture : 1; 570 bool m_lockedPendingUserGesture : 1;
572 bool m_playing : 1; 571 bool m_playing : 1;
573 bool m_shouldDelayLoadEvent : 1; 572 bool m_shouldDelayLoadEvent : 1;
574 bool m_haveFiredLoadedData : 1; 573 bool m_haveFiredLoadedData : 1;
575 bool m_autoplaying : 1; 574 bool m_autoplaying : 1;
576 bool m_muted : 1; 575 bool m_muted : 1;
577 bool m_paused : 1; 576 bool m_paused : 1;
578 bool m_seeking : 1; 577 bool m_seeking : 1;
579 578
(...skipping 19 matching lines...) Expand all
599 598
600 Member<CueTimeline> m_cueTimeline; 599 Member<CueTimeline> m_cueTimeline;
601 600
602 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolvers; 601 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolvers;
603 std::unique_ptr<CancellableTaskFactory> m_playPromiseResolveTask; 602 std::unique_ptr<CancellableTaskFactory> m_playPromiseResolveTask;
604 std::unique_ptr<CancellableTaskFactory> m_playPromiseRejectTask; 603 std::unique_ptr<CancellableTaskFactory> m_playPromiseRejectTask;
605 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; 604 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList;
606 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; 605 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList;
607 ExceptionCode m_playPromiseErrorCode; 606 ExceptionCode m_playPromiseErrorCode;
608 607
608 std::unique_ptr<CancellableTaskFactory> m_resourceSelectionAlgorithmContinua tionTask;
609 std::unique_ptr<CancellableTaskFactory> m_loadNextSourceChildAfterErrorTask;
610
609 // This is a weak reference, since m_audioSourceNode holds a reference to us . 611 // This is a weak reference, since m_audioSourceNode holds a reference to us .
610 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. 612 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem.
611 GC_PLUGIN_IGNORE("http://crbug.com/404577") 613 GC_PLUGIN_IGNORE("http://crbug.com/404577")
612 WeakMember<AudioSourceProviderClient> m_audioSourceNode; 614 WeakMember<AudioSourceProviderClient> m_audioSourceNode;
613 615
614 // AudioClientImpl wraps an AudioSourceProviderClient. 616 // AudioClientImpl wraps an AudioSourceProviderClient.
615 // When the audio format is known, Chromium calls setFormat(). 617 // When the audio format is known, Chromium calls setFormat().
616 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient { 618 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient {
617 public: 619 public:
618 explicit AudioClientImpl(AudioSourceProviderClient* client) 620 explicit AudioClientImpl(AudioSourceProviderClient* client)
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 inline bool isHTMLMediaElement(const HTMLElement& element) 684 inline bool isHTMLMediaElement(const HTMLElement& element)
683 { 685 {
684 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 686 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
685 } 687 }
686 688
687 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 689 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
688 690
689 } // namespace blink 691 } // namespace blink
690 692
691 #endif // HTMLMediaElement_h 693 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698