Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 ViewportIntersectionObserver; |
| 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 Loading... | |
| 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 WebMediaPlayer::ViewportIntersectionInfo viewportIntersectInfo() const { | |
|
miu
2016/11/16 02:40:26
naming suggestion: How about something more descri
xjz
2016/11/16 07:45:55
Done.
| |
| 313 return m_viewportIntersectInfo; | |
| 314 } | |
| 315 | |
| 312 protected: | 316 protected: |
| 313 HTMLMediaElement(const QualifiedName&, Document&); | 317 HTMLMediaElement(const QualifiedName&, Document&); |
| 314 ~HTMLMediaElement() override; | 318 ~HTMLMediaElement() override; |
| 315 void dispose(); | 319 void dispose(); |
| 316 | 320 |
| 317 void parseAttribute(const QualifiedName&, | 321 void parseAttribute(const QualifiedName&, |
| 318 const AtomicString&, | 322 const AtomicString&, |
| 319 const AtomicString&) override; | 323 const AtomicString&) override; |
| 320 void finishParsingChildren() final; | 324 void finishParsingChildren() final; |
| 321 bool isURLAttribute(const Attribute&) const override; | 325 bool isURLAttribute(const Attribute&) const override; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 527 void scheduleResolvePlayPromises(); | 531 void scheduleResolvePlayPromises(); |
| 528 void scheduleRejectPlayPromises(ExceptionCode); | 532 void scheduleRejectPlayPromises(ExceptionCode); |
| 529 void scheduleNotifyPlaying(); | 533 void scheduleNotifyPlaying(); |
| 530 void resolveScheduledPlayPromises(); | 534 void resolveScheduledPlayPromises(); |
| 531 void rejectScheduledPlayPromises(); | 535 void rejectScheduledPlayPromises(); |
| 532 void rejectPlayPromises(ExceptionCode, const String&); | 536 void rejectPlayPromises(ExceptionCode, const String&); |
| 533 void rejectPlayPromisesInternal(ExceptionCode, const String&); | 537 void rejectPlayPromisesInternal(ExceptionCode, const String&); |
| 534 | 538 |
| 535 EnumerationHistogram& showControlsHistogram() const; | 539 EnumerationHistogram& showControlsHistogram() const; |
| 536 | 540 |
| 537 void onVisibilityChangedForAutoplay(bool isVisible); | 541 void onVideoViewportIntersectionChanged(const WebRect& rootRect, |
| 542 const WebRect& intersectRect); | |
| 538 | 543 |
| 539 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; | 544 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; |
| 540 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; | 545 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; |
| 541 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; | 546 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; |
| 542 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; | 547 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; |
| 543 Member<TimeRanges> m_playedTimeRanges; | 548 Member<TimeRanges> m_playedTimeRanges; |
| 544 Member<GenericEventQueue> m_asyncEventQueue; | 549 Member<GenericEventQueue> m_asyncEventQueue; |
| 545 | 550 |
| 546 double m_playbackRate; | 551 double m_playbackRate; |
| 547 double m_defaultPlaybackRate; | 552 double m_defaultPlaybackRate; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; | 656 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; |
| 652 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; | 657 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; |
| 653 ExceptionCode m_playPromiseErrorCode; | 658 ExceptionCode m_playPromiseErrorCode; |
| 654 | 659 |
| 655 // This is a weak reference, since m_audioSourceNode holds a reference to us. | 660 // 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 | 661 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan |
| 657 // where strong cycles are not a problem. | 662 // where strong cycles are not a problem. |
| 658 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 663 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 659 WeakMember<AudioSourceProviderClient> m_audioSourceNode; | 664 WeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 660 | 665 |
| 666 WebMediaPlayer::ViewportIntersectionInfo m_viewportIntersectInfo; | |
| 667 | |
| 661 // AudioClientImpl wraps an AudioSourceProviderClient. | 668 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 662 // When the audio format is known, Chromium calls setFormat(). | 669 // When the audio format is known, Chromium calls setFormat(). |
| 663 class AudioClientImpl final | 670 class AudioClientImpl final |
| 664 : public GarbageCollectedFinalized<AudioClientImpl>, | 671 : public GarbageCollectedFinalized<AudioClientImpl>, |
| 665 public WebAudioSourceProviderClient { | 672 public WebAudioSourceProviderClient { |
| 666 public: | 673 public: |
| 667 explicit AudioClientImpl(AudioSourceProviderClient* client) | 674 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 668 : m_client(client) {} | 675 : m_client(client) {} |
| 669 | 676 |
| 670 ~AudioClientImpl() override {} | 677 ~AudioClientImpl() override {} |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 | 716 |
| 710 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings | 717 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings |
| 711 friend class Internals; | 718 friend class Internals; |
| 712 friend class TrackDisplayUpdateScope; | 719 friend class TrackDisplayUpdateScope; |
| 713 friend class AutoplayExperimentHelper; | 720 friend class AutoplayExperimentHelper; |
| 714 friend class MediaControlsTest; | 721 friend class MediaControlsTest; |
| 715 | 722 |
| 716 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; | 723 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; |
| 717 Member<AutoplayExperimentHelper> m_autoplayHelper; | 724 Member<AutoplayExperimentHelper> m_autoplayHelper; |
| 718 Member<AutoplayUmaHelper> m_autoplayUmaHelper; | 725 Member<AutoplayUmaHelper> m_autoplayUmaHelper; |
| 726 bool m_shouldAutoplayWhenVisible = false; | |
| 719 | 727 |
| 720 WebRemotePlaybackClient* m_remotePlaybackClient; | 728 WebRemotePlaybackClient* m_remotePlaybackClient; |
| 721 | 729 |
| 722 // class AutoplayVisibilityObserver; | 730 Member<ViewportIntersectionObserver> m_viewportIntersectionObserver; |
| 723 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver; | |
| 724 | 731 |
| 725 static URLRegistry* s_mediaStreamRegistry; | 732 static URLRegistry* s_mediaStreamRegistry; |
| 726 }; | 733 }; |
| 727 | 734 |
| 728 inline bool isHTMLMediaElement(const HTMLElement& element) { | 735 inline bool isHTMLMediaElement(const HTMLElement& element) { |
| 729 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 736 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 730 } | 737 } |
| 731 | 738 |
| 732 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 739 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 733 | 740 |
| 734 } // namespace blink | 741 } // namespace blink |
| 735 | 742 |
| 736 #endif // HTMLMediaElement_h | 743 #endif // HTMLMediaElement_h |
| OLD | NEW |