Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef HTMLMediaElement_h | 26 #ifndef HTMLMediaElement_h |
| 27 #define HTMLMediaElement_h | 27 #define HTMLMediaElement_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptPromise.h" | |
| 29 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 30 #include "core/dom/ActiveDOMObject.h" | 31 #include "core/dom/ActiveDOMObject.h" |
| 31 #include "core/events/GenericEventQueue.h" | 32 #include "core/events/GenericEventQueue.h" |
| 32 #include "core/html/AutoplayExperimentHelper.h" | 33 #include "core/html/AutoplayExperimentHelper.h" |
| 33 #include "core/html/HTMLElement.h" | 34 #include "core/html/HTMLElement.h" |
| 35 #include "core/html/MediaError.h" | |
|
philipj_slow
2016/02/02 09:56:33
How about including DOMException.h and using Excep
mlamouri (slow - plz ping)
2016/02/03 19:28:58
Included ExceptionCode.h.
| |
| 34 #include "core/html/track/TextTrack.h" | 36 #include "core/html/track/TextTrack.h" |
| 35 #include "platform/Supplementable.h" | 37 #include "platform/Supplementable.h" |
| 36 #include "platform/audio/AudioSourceProvider.h" | 38 #include "platform/audio/AudioSourceProvider.h" |
| 37 #include "public/platform/WebAudioSourceProviderClient.h" | 39 #include "public/platform/WebAudioSourceProviderClient.h" |
| 38 #include "public/platform/WebMediaPlayerClient.h" | 40 #include "public/platform/WebMediaPlayerClient.h" |
| 39 #include "public/platform/WebMimeRegistry.h" | 41 #include "public/platform/WebMimeRegistry.h" |
| 40 | 42 |
| 41 namespace blink { | 43 namespace blink { |
| 42 | 44 |
| 43 class AudioSourceProviderClient; | 45 class AudioSourceProviderClient; |
| 44 class AudioTrackList; | 46 class AudioTrackList; |
| 45 class ContentType; | 47 class ContentType; |
| 46 class CueTimeline; | 48 class CueTimeline; |
| 47 class Event; | 49 class Event; |
| 48 class ExceptionState; | 50 class ExceptionState; |
| 49 class HTMLSourceElement; | 51 class HTMLSourceElement; |
| 50 class HTMLTrackElement; | 52 class HTMLTrackElement; |
| 51 class KURL; | 53 class KURL; |
| 52 class MediaControls; | 54 class MediaControls; |
| 53 class MediaError; | |
| 54 class HTMLMediaSource; | 55 class HTMLMediaSource; |
| 56 class ScriptState; | |
| 55 class TextTrackContainer; | 57 class TextTrackContainer; |
| 56 class TextTrackList; | 58 class TextTrackList; |
| 57 class TimeRanges; | 59 class TimeRanges; |
| 58 class URLRegistry; | 60 class URLRegistry; |
| 59 class VideoTrackList; | 61 class VideoTrackList; |
| 60 class WebAudioSourceProvider; | 62 class WebAudioSourceProvider; |
| 61 class WebInbandTextTrack; | 63 class WebInbandTextTrack; |
| 62 class WebLayer; | 64 class WebLayer; |
| 63 | 65 |
| 64 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple mentable<HTMLMediaElement>, public ActiveDOMObject, private WebMediaPlayerClient { | 66 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple mentable<HTMLMediaElement>, public ActiveDOMObject, private WebMediaPlayerClient { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 void setPlaybackRate(double); | 131 void setPlaybackRate(double); |
| 130 void updatePlaybackRate(); | 132 void updatePlaybackRate(); |
| 131 TimeRanges* played(); | 133 TimeRanges* played(); |
| 132 TimeRanges* seekable() const; | 134 TimeRanges* seekable() const; |
| 133 bool ended() const; | 135 bool ended() const; |
| 134 bool autoplay() const; | 136 bool autoplay() const; |
| 135 enum class RecordMetricsBehavior { DoNotRecord, DoRecord }; | 137 enum class RecordMetricsBehavior { DoNotRecord, DoRecord }; |
| 136 bool shouldAutoplay(const RecordMetricsBehavior = RecordMetricsBehavior::DoN otRecord); | 138 bool shouldAutoplay(const RecordMetricsBehavior = RecordMetricsBehavior::DoN otRecord); |
| 137 bool loop() const; | 139 bool loop() const; |
| 138 void setLoop(bool); | 140 void setLoop(bool); |
| 139 void play(); | 141 ScriptPromise play(ScriptState*); |
| 142 // This does not check user gesture restrictions. | |
| 143 void playInternal(); | |
| 140 void pause(); | 144 void pause(); |
| 141 void requestRemotePlayback(); | 145 void requestRemotePlayback(); |
| 142 void requestRemotePlaybackControl(); | 146 void requestRemotePlaybackControl(); |
| 143 | 147 |
| 144 // statistics | 148 // statistics |
| 145 unsigned webkitAudioDecodedByteCount() const; | 149 unsigned webkitAudioDecodedByteCount() const; |
| 146 unsigned webkitVideoDecodedByteCount() const; | 150 unsigned webkitVideoDecodedByteCount() const; |
| 147 | 151 |
| 148 // media source extensions | 152 // media source extensions |
| 149 void closeMediaSource(); | 153 void closeMediaSource(); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 // deferred loading (preload=none) | 366 // deferred loading (preload=none) |
| 363 bool loadIsDeferred() const; | 367 bool loadIsDeferred() const; |
| 364 void deferLoad(); | 368 void deferLoad(); |
| 365 void cancelDeferredLoad(); | 369 void cancelDeferredLoad(); |
| 366 void startDeferredLoad(); | 370 void startDeferredLoad(); |
| 367 void executeDeferredLoad(); | 371 void executeDeferredLoad(); |
| 368 void deferredLoadTimerFired(Timer<HTMLMediaElement>*); | 372 void deferredLoadTimerFired(Timer<HTMLMediaElement>*); |
| 369 | 373 |
| 370 void markCaptionAndSubtitleTracksAsUnconfigured(); | 374 void markCaptionAndSubtitleTracksAsUnconfigured(); |
| 371 | 375 |
| 372 // This does not check user gesture restrictions. | |
| 373 void playInternal(); | |
| 374 | |
| 375 // This does not change the buffering strategy. | 376 // This does not change the buffering strategy. |
| 376 void pauseInternal(); | 377 void pauseInternal(); |
| 377 | 378 |
| 378 // If we are about to enter a paused state, call this to record | 379 // If we are about to enter a paused state, call this to record |
| 379 // autoplay metrics. If we were already in a stopped state, then | 380 // autoplay metrics. If we were already in a stopped state, then |
| 380 // this does nothing. | 381 // this does nothing. |
| 381 void recordMetricsIfPausing(); | 382 void recordMetricsIfPausing(); |
| 382 // Could stopping at this point be considered a bailout of playback? | 383 // Could stopping at this point be considered a bailout of playback? |
| 383 // (as in, "The user really didn't want to play this"). | 384 // (as in, "The user really didn't want to play this"). |
| 384 bool isBailout() const; | 385 bool isBailout() const; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 void removeUserGestureRequirement(); | 439 void removeUserGestureRequirement(); |
| 439 void setInitialPlayWithoutUserGestures(bool); | 440 void setInitialPlayWithoutUserGestures(bool); |
| 440 | 441 |
| 441 void setNetworkState(NetworkState); | 442 void setNetworkState(NetworkState); |
| 442 | 443 |
| 443 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 444 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
| 444 | 445 |
| 445 // TODO(liberato): remove once autoplay gesture override experiment conclude s. | 446 // TODO(liberato): remove once autoplay gesture override experiment conclude s. |
| 446 void triggerAutoplayViewportCheckForTesting(); | 447 void triggerAutoplayViewportCheckForTesting(); |
| 447 | 448 |
| 449 void scheduleResolvePlayPromises(); | |
| 450 void scheduleRejectPlayPromises(MediaError::Code); | |
| 451 void scheduleNotifyPlaying(); | |
| 452 | |
| 453 void resolvePlayPromises(); | |
| 454 void rejectPlayPromises(MediaError::Code); | |
| 455 | |
| 448 UnthrottledTimer<HTMLMediaElement> m_loadTimer; | 456 UnthrottledTimer<HTMLMediaElement> m_loadTimer; |
| 449 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; | 457 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; |
| 450 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; | 458 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; |
| 451 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; | 459 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; |
| 452 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; | 460 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; |
| 453 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 461 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
| 454 | 462 |
| 455 double m_playbackRate; | 463 double m_playbackRate; |
| 456 double m_defaultPlaybackRate; | 464 double m_defaultPlaybackRate; |
| 457 NetworkState m_networkState; | 465 NetworkState m_networkState; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 549 // Whether this element is in overlay fullscreen mode. | 557 // Whether this element is in overlay fullscreen mode. |
| 550 bool m_inOverlayFullscreenVideo : 1; | 558 bool m_inOverlayFullscreenVideo : 1; |
| 551 | 559 |
| 552 PersistentWillBeMember<AudioTrackList> m_audioTracks; | 560 PersistentWillBeMember<AudioTrackList> m_audioTracks; |
| 553 PersistentWillBeMember<VideoTrackList> m_videoTracks; | 561 PersistentWillBeMember<VideoTrackList> m_videoTracks; |
| 554 PersistentWillBeMember<TextTrackList> m_textTracks; | 562 PersistentWillBeMember<TextTrackList> m_textTracks; |
| 555 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso urceSelectionBegan; | 563 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso urceSelectionBegan; |
| 556 | 564 |
| 557 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 565 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
| 558 | 566 |
| 567 PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playRe solvers; | |
| 568 | |
| 559 // This is a weak reference, since m_audioSourceNode holds a reference to us . | 569 // This is a weak reference, since m_audioSourceNode holds a reference to us . |
| 560 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. | 570 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. |
| 561 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 571 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 562 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 572 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 563 | 573 |
| 564 // AudioClientImpl wraps an AudioSourceProviderClient. | 574 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 565 // When the audio format is known, Chromium calls setFormat(). | 575 // When the audio format is known, Chromium calls setFormat(). |
| 566 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient { | 576 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient { |
| 567 public: | 577 public: |
| 568 explicit AudioClientImpl(AudioSourceProviderClient* client) | 578 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 623 inline bool isHTMLMediaElement(const HTMLElement& element) | 633 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 624 { | 634 { |
| 625 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 635 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 626 } | 636 } |
| 627 | 637 |
| 628 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 638 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 629 | 639 |
| 630 } // namespace blink | 640 } // namespace blink |
| 631 | 641 |
| 632 #endif // HTMLMediaElement_h | 642 #endif // HTMLMediaElement_h |
| OLD | NEW |