| 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 ElementViewportIntersectionObserver; |
| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 void notifyPositionMayHaveChanged(const IntRect&); | 305 void notifyPositionMayHaveChanged(const IntRect&); |
| 306 void updatePositionNotificationRegistration(); | 306 void updatePositionNotificationRegistration(); |
| 307 | 307 |
| 308 WebRemotePlaybackClient* remotePlaybackClient() { | 308 WebRemotePlaybackClient* remotePlaybackClient() { |
| 309 return m_remotePlaybackClient; | 309 return m_remotePlaybackClient; |
| 310 } | 310 } |
| 311 const WebRemotePlaybackClient* remotePlaybackClient() const { | 311 const WebRemotePlaybackClient* remotePlaybackClient() const { |
| 312 return m_remotePlaybackClient; | 312 return m_remotePlaybackClient; |
| 313 } | 313 } |
| 314 | 314 |
| 315 WebMediaPlayer::ViewportIntersectionInfo currentViewportIntersection() const { |
| 316 return m_currentViewportIntersection; |
| 317 } |
| 318 |
| 315 protected: | 319 protected: |
| 316 HTMLMediaElement(const QualifiedName&, Document&); | 320 HTMLMediaElement(const QualifiedName&, Document&); |
| 317 ~HTMLMediaElement() override; | 321 ~HTMLMediaElement() override; |
| 318 void dispose(); | 322 void dispose(); |
| 319 | 323 |
| 320 void parseAttribute(const QualifiedName&, | 324 void parseAttribute(const QualifiedName&, |
| 321 const AtomicString&, | 325 const AtomicString&, |
| 322 const AtomicString&) override; | 326 const AtomicString&) override; |
| 323 void finishParsingChildren() final; | 327 void finishParsingChildren() final; |
| 324 bool isURLAttribute(const Attribute&) const override; | 328 bool isURLAttribute(const Attribute&) const override; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 void scheduleResolvePlayPromises(); | 539 void scheduleResolvePlayPromises(); |
| 536 void scheduleRejectPlayPromises(ExceptionCode); | 540 void scheduleRejectPlayPromises(ExceptionCode); |
| 537 void scheduleNotifyPlaying(); | 541 void scheduleNotifyPlaying(); |
| 538 void resolveScheduledPlayPromises(); | 542 void resolveScheduledPlayPromises(); |
| 539 void rejectScheduledPlayPromises(); | 543 void rejectScheduledPlayPromises(); |
| 540 void rejectPlayPromises(ExceptionCode, const String&); | 544 void rejectPlayPromises(ExceptionCode, const String&); |
| 541 void rejectPlayPromisesInternal(ExceptionCode, const String&); | 545 void rejectPlayPromisesInternal(ExceptionCode, const String&); |
| 542 | 546 |
| 543 EnumerationHistogram& showControlsHistogram() const; | 547 EnumerationHistogram& showControlsHistogram() const; |
| 544 | 548 |
| 545 void onVisibilityChangedForAutoplay(bool isVisible); | 549 void onVideoViewportIntersectionChanged(const WebRect& rootRect, |
| 550 const WebRect& intersectRect); |
| 546 | 551 |
| 547 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; | 552 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; |
| 548 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; | 553 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; |
| 549 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; | 554 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; |
| 550 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; | 555 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; |
| 551 Member<TimeRanges> m_playedTimeRanges; | 556 Member<TimeRanges> m_playedTimeRanges; |
| 552 Member<GenericEventQueue> m_asyncEventQueue; | 557 Member<GenericEventQueue> m_asyncEventQueue; |
| 553 | 558 |
| 554 double m_playbackRate; | 559 double m_playbackRate; |
| 555 double m_defaultPlaybackRate; | 560 double m_defaultPlaybackRate; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; | 665 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolveList; |
| 661 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; | 666 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseRejectList; |
| 662 ExceptionCode m_playPromiseErrorCode; | 667 ExceptionCode m_playPromiseErrorCode; |
| 663 | 668 |
| 664 // This is a weak reference, since m_audioSourceNode holds a reference to us. | 669 // This is a weak reference, since m_audioSourceNode holds a reference to us. |
| 665 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan | 670 // TODO(Oilpan): Consider making this a strongly traced pointer with oilpan |
| 666 // where strong cycles are not a problem. | 671 // where strong cycles are not a problem. |
| 667 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 672 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 668 WeakMember<AudioSourceProviderClient> m_audioSourceNode; | 673 WeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 669 | 674 |
| 675 WebMediaPlayer::ViewportIntersectionInfo m_currentViewportIntersection; |
| 676 |
| 670 // AudioClientImpl wraps an AudioSourceProviderClient. | 677 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 671 // When the audio format is known, Chromium calls setFormat(). | 678 // When the audio format is known, Chromium calls setFormat(). |
| 672 class AudioClientImpl final | 679 class AudioClientImpl final |
| 673 : public GarbageCollectedFinalized<AudioClientImpl>, | 680 : public GarbageCollectedFinalized<AudioClientImpl>, |
| 674 public WebAudioSourceProviderClient { | 681 public WebAudioSourceProviderClient { |
| 675 public: | 682 public: |
| 676 explicit AudioClientImpl(AudioSourceProviderClient* client) | 683 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 677 : m_client(client) {} | 684 : m_client(client) {} |
| 678 | 685 |
| 679 ~AudioClientImpl() override {} | 686 ~AudioClientImpl() override {} |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 | 725 |
| 719 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings | 726 friend class AutoplayUmaHelper; // for isAutoplayAllowedPerSettings |
| 720 friend class Internals; | 727 friend class Internals; |
| 721 friend class TrackDisplayUpdateScope; | 728 friend class TrackDisplayUpdateScope; |
| 722 friend class AutoplayExperimentHelper; | 729 friend class AutoplayExperimentHelper; |
| 723 friend class MediaControlsTest; | 730 friend class MediaControlsTest; |
| 724 | 731 |
| 725 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; | 732 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; |
| 726 Member<AutoplayExperimentHelper> m_autoplayHelper; | 733 Member<AutoplayExperimentHelper> m_autoplayHelper; |
| 727 Member<AutoplayUmaHelper> m_autoplayUmaHelper; | 734 Member<AutoplayUmaHelper> m_autoplayUmaHelper; |
| 735 bool m_shouldAutoplayWhenVisible = false; |
| 728 | 736 |
| 729 WebRemotePlaybackClient* m_remotePlaybackClient; | 737 WebRemotePlaybackClient* m_remotePlaybackClient; |
| 730 | 738 |
| 731 // class AutoplayVisibilityObserver; | 739 Member<ElementViewportIntersectionObserver> m_viewportIntersectionObserver; |
| 732 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver; | |
| 733 | 740 |
| 734 static URLRegistry* s_mediaStreamRegistry; | 741 static URLRegistry* s_mediaStreamRegistry; |
| 735 }; | 742 }; |
| 736 | 743 |
| 737 inline bool isHTMLMediaElement(const HTMLElement& element) { | 744 inline bool isHTMLMediaElement(const HTMLElement& element) { |
| 738 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 745 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 739 } | 746 } |
| 740 | 747 |
| 741 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 748 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 742 | 749 |
| 743 } // namespace blink | 750 } // namespace blink |
| 744 | 751 |
| 745 #endif // HTMLMediaElement_h | 752 #endif // HTMLMediaElement_h |
| OLD | NEW |