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

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

Issue 2475643004: Monitor the intersection of video and viewport. (Closed)
Patch Set: Addressed miu's comments from PS#5. 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include <memory> 45 #include <memory>
46 46
47 namespace blink { 47 namespace blink {
48 48
49 class AudioSourceProviderClient; 49 class AudioSourceProviderClient;
50 class AudioTrack; 50 class AudioTrack;
51 class AudioTrackList; 51 class AudioTrackList;
52 class AutoplayUmaHelper; 52 class AutoplayUmaHelper;
53 class ContentType; 53 class ContentType;
54 class CueTimeline; 54 class CueTimeline;
55 class ElementVisibilityObserver; 55 class ElementViewportRatioObserver;
56 class EnumerationHistogram; 56 class EnumerationHistogram;
57 class Event; 57 class Event;
58 class ExceptionState; 58 class ExceptionState;
59 class HTMLSourceElement; 59 class HTMLSourceElement;
60 class HTMLTrackElement; 60 class HTMLTrackElement;
61 class KURL; 61 class KURL;
62 class MediaControls; 62 class MediaControls;
63 class MediaError; 63 class MediaError;
64 class MediaStreamDescriptor; 64 class MediaStreamDescriptor;
65 class HTMLMediaSource; 65 class HTMLMediaSource;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 // Temporary callback for crbug.com/487345,402044 303 // Temporary callback for crbug.com/487345,402044
304 void notifyPositionMayHaveChanged(const IntRect&); 304 void notifyPositionMayHaveChanged(const IntRect&);
305 void updatePositionNotificationRegistration(); 305 void updatePositionNotificationRegistration();
306 306
307 WebRemotePlaybackClient* remotePlaybackClient() { 307 WebRemotePlaybackClient* remotePlaybackClient() {
308 return m_remotePlaybackClient; 308 return m_remotePlaybackClient;
309 } 309 }
310 void setRemotePlaybackClient(WebRemotePlaybackClient*); 310 void setRemotePlaybackClient(WebRemotePlaybackClient*);
311 311
312 float videoViewportRatio() const { return m_viewportRatio; }
313
312 protected: 314 protected:
313 HTMLMediaElement(const QualifiedName&, Document&); 315 HTMLMediaElement(const QualifiedName&, Document&);
314 ~HTMLMediaElement() override; 316 ~HTMLMediaElement() override;
315 void dispose(); 317 void dispose();
316 318
317 void parseAttribute(const QualifiedName&, 319 void parseAttribute(const QualifiedName&,
318 const AtomicString&, 320 const AtomicString&,
319 const AtomicString&) override; 321 const AtomicString&) override;
320 void finishParsingChildren() final; 322 void finishParsingChildren() final;
321 bool isURLAttribute(const Attribute&) const override; 323 bool isURLAttribute(const Attribute&) const override;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 void scheduleResolvePlayPromises(); 529 void scheduleResolvePlayPromises();
528 void scheduleRejectPlayPromises(ExceptionCode); 530 void scheduleRejectPlayPromises(ExceptionCode);
529 void scheduleNotifyPlaying(); 531 void scheduleNotifyPlaying();
530 void resolveScheduledPlayPromises(); 532 void resolveScheduledPlayPromises();
531 void rejectScheduledPlayPromises(); 533 void rejectScheduledPlayPromises();
532 void rejectPlayPromises(ExceptionCode, const String&); 534 void rejectPlayPromises(ExceptionCode, const String&);
533 void rejectPlayPromisesInternal(ExceptionCode, const String&); 535 void rejectPlayPromisesInternal(ExceptionCode, const String&);
534 536
535 EnumerationHistogram& showControlsHistogram() const; 537 EnumerationHistogram& showControlsHistogram() const;
536 538
537 void onVisibilityChangedForAutoplay(bool isVisible); 539 void onVideoViewportRatioChanged(float ratio);
538 540
539 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; 541 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer;
540 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; 542 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer;
541 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; 543 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer;
542 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; 544 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer;
543 Member<TimeRanges> m_playedTimeRanges; 545 Member<TimeRanges> m_playedTimeRanges;
544 Member<GenericEventQueue> m_asyncEventQueue; 546 Member<GenericEventQueue> m_asyncEventQueue;
545 547
546 double m_playbackRate; 548 double m_playbackRate;
547 double m_defaultPlaybackRate; 549 double m_defaultPlaybackRate;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; 653 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList;
652 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; 654 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList;
653 ExceptionCode m_playPromiseErrorCode; 655 ExceptionCode m_playPromiseErrorCode;
654 656
655 // This is a weak reference, since m_audioSourceNode holds a reference to us. 657 // This is a weak reference, since m_audioSourceNode holds a reference to us.
656 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan 658 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan
657 // where strong cycles are not a problem. 659 // where strong cycles are not a problem.
658 GC_PLUGIN_IGNORE("http://crbug.com/404577") 660 GC_PLUGIN_IGNORE("http://crbug.com/404577")
659 WeakMember<AudioSourceProviderClient> m_audioSourceNode; 661 WeakMember<AudioSourceProviderClient> m_audioSourceNode;
660 662
663 float m_viewportRatio = 0;
664
661 // AudioClientImpl wraps an AudioSourceProviderClient. 665 // AudioClientImpl wraps an AudioSourceProviderClient.
662 // When the audio format is known, Chromium calls setFormat(). 666 // When the audio format is known, Chromium calls setFormat().
663 class AudioClientImpl final 667 class AudioClientImpl final
664 : public GarbageCollectedFinalized<AudioClientImpl>, 668 : public GarbageCollectedFinalized<AudioClientImpl>,
665 public WebAudioSourceProviderClient { 669 public WebAudioSourceProviderClient {
666 public: 670 public:
667 explicit AudioClientImpl(AudioSourceProviderClient* client) 671 explicit AudioClientImpl(AudioSourceProviderClient* client)
668 : m_client(client) {} 672 : m_client(client) {}
669 673
670 ~AudioClientImpl() override {} 674 ~AudioClientImpl() override {}
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 713
710 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings 714 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings
711 friend class Internals; 715 friend class Internals;
712 friend class TrackDisplayUpdateScope; 716 friend class TrackDisplayUpdateScope;
713 friend class AutoplayExperimentHelper; 717 friend class AutoplayExperimentHelper;
714 friend class MediaControlsTest; 718 friend class MediaControlsTest;
715 719
716 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; 720 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient;
717 Member<AutoplayExperimentHelper> m_autoplayHelper; 721 Member<AutoplayExperimentHelper> m_autoplayHelper;
718 Member<AutoplayUmaHelper> m_autoplayUmaHelper; 722 Member<AutoplayUmaHelper> m_autoplayUmaHelper;
723 bool m_shouldAutoplayWhenVisible = false;
719 724
720 WebRemotePlaybackClient* m_remotePlaybackClient; 725 WebRemotePlaybackClient* m_remotePlaybackClient;
721 726
722 // class AutoplayVisibilityObserver; 727 Member<ElementViewportRatioObserver> m_videoViewportRatioObserver;
723 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver;
724 728
725 static URLRegistry* s_mediaStreamRegistry; 729 static URLRegistry* s_mediaStreamRegistry;
726 }; 730 };
727 731
728 inline bool isHTMLMediaElement(const HTMLElement& element) { 732 inline bool isHTMLMediaElement(const HTMLElement& element) {
729 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 733 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
730 } 734 }
731 735
732 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 736 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
733 737
734 } // namespace blink 738 } // namespace blink
735 739
736 #endif // HTMLMediaElement_h 740 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698