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

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

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)
Patch Set: Consolidate two ElementVisibilityObserver in AUtoplayUmaHelper. Created 4 years, 1 month 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 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 void scheduleResolvePlayPromises(); 527 void scheduleResolvePlayPromises();
528 void scheduleRejectPlayPromises(ExceptionCode); 528 void scheduleRejectPlayPromises(ExceptionCode);
529 void scheduleNotifyPlaying(); 529 void scheduleNotifyPlaying();
530 void resolveScheduledPlayPromises(); 530 void resolveScheduledPlayPromises();
531 void rejectScheduledPlayPromises(); 531 void rejectScheduledPlayPromises();
532 void rejectPlayPromises(ExceptionCode, const String&); 532 void rejectPlayPromises(ExceptionCode, const String&);
533 void rejectPlayPromisesInternal(ExceptionCode, const String&); 533 void rejectPlayPromisesInternal(ExceptionCode, const String&);
534 534
535 EnumerationHistogram& showControlsHistogram() const; 535 EnumerationHistogram& showControlsHistogram() const;
536 536
537 void onVisibilityChangedForAutoplay(bool isVisible); 537 void onVideoViewportRatioChanged(bool isVisible);
538 538
539 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; 539 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer;
540 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; 540 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer;
541 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; 541 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer;
542 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; 542 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer;
543 Member<TimeRanges> m_playedTimeRanges; 543 Member<TimeRanges> m_playedTimeRanges;
544 Member<GenericEventQueue> m_asyncEventQueue; 544 Member<GenericEventQueue> m_asyncEventQueue;
545 545
546 double m_playbackRate; 546 double m_playbackRate;
547 double m_defaultPlaybackRate; 547 double m_defaultPlaybackRate;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 709
710 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings 710 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings
711 friend class Internals; 711 friend class Internals;
712 friend class TrackDisplayUpdateScope; 712 friend class TrackDisplayUpdateScope;
713 friend class AutoplayExperimentHelper; 713 friend class AutoplayExperimentHelper;
714 friend class MediaControlsTest; 714 friend class MediaControlsTest;
715 715
716 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; 716 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient;
717 Member<AutoplayExperimentHelper> m_autoplayHelper; 717 Member<AutoplayExperimentHelper> m_autoplayHelper;
718 Member<AutoplayUmaHelper> m_autoplayUmaHelper; 718 Member<AutoplayUmaHelper> m_autoplayUmaHelper;
719 bool m_autoplayWhenVisible = false;
miu 2016/11/05 02:47:47 naming nit: m_shouldAutoplayWhenVisible
miu 2016/11/05 02:47:47 Is the boolean necessary? (See comment in .cpp fil
xjz 2016/11/09 02:24:28 I keeps this boolean to save a bunch of checks eve
xjz 2016/11/09 02:24:28 Done.
719 720
720 WebRemotePlaybackClient* m_remotePlaybackClient; 721 WebRemotePlaybackClient* m_remotePlaybackClient;
721 722
722 // class AutoplayVisibilityObserver; 723 Member<ElementVisibilityObserver> m_videoViewportRatioObserver;
723 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver;
724 724
725 static URLRegistry* s_mediaStreamRegistry; 725 static URLRegistry* s_mediaStreamRegistry;
726 }; 726 };
727 727
728 inline bool isHTMLMediaElement(const HTMLElement& element) { 728 inline bool isHTMLMediaElement(const HTMLElement& element) {
729 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 729 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
730 } 730 }
731 731
732 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 732 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
733 733
734 } // namespace blink 734 } // namespace blink
735 735
736 #endif // HTMLMediaElement_h 736 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698