| 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 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 class TextTrackContainer; | 59 class TextTrackContainer; |
| 60 class TextTrackList; | 60 class TextTrackList; |
| 61 class TimeRanges; | 61 class TimeRanges; |
| 62 class URLRegistry; | 62 class URLRegistry; |
| 63 class VideoTrackList; | 63 class VideoTrackList; |
| 64 class WebAudioSourceProvider; | 64 class WebAudioSourceProvider; |
| 65 class WebInbandTextTrack; | 65 class WebInbandTextTrack; |
| 66 class WebLayer; | 66 class WebLayer; |
| 67 class WebRemotePlaybackClient; | 67 class WebRemotePlaybackClient; |
| 68 | 68 |
| 69 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple
mentable<HTMLMediaElement>, public ActiveScriptWrappable, public ActiveDOMObject
, private WebMediaPlayerClient { | 69 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public HeapSupplementab
le<HTMLMediaElement>, public ActiveScriptWrappable, public ActiveDOMObject, priv
ate WebMediaPlayerClient { |
| 70 DEFINE_WRAPPERTYPEINFO(); | 70 DEFINE_WRAPPERTYPEINFO(); |
| 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); | 71 USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); |
| 72 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); | 72 USING_PRE_FINALIZER(HTMLMediaElement, dispose); |
| 73 public: | 73 public: |
| 74 static WebMimeRegistry::SupportsType supportsType(const ContentType&); | 74 static WebMimeRegistry::SupportsType supportsType(const ContentType&); |
| 75 | 75 |
| 76 enum class RecordMetricsBehavior { | 76 enum class RecordMetricsBehavior { |
| 77 DoNotRecord, | 77 DoNotRecord, |
| 78 DoRecord | 78 DoRecord |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 static void setMediaStreamRegistry(URLRegistry*); | 81 static void setMediaStreamRegistry(URLRegistry*); |
| 82 static bool isMediaStreamURL(const String& url); | 82 static bool isMediaStreamURL(const String& url); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 AudioSourceProvider& getAudioSourceProvider() { return m_audioSourceProvider
; } | 242 AudioSourceProvider& getAudioSourceProvider() { return m_audioSourceProvider
; } |
| 243 | 243 |
| 244 enum InvalidURLAction { DoNothing, Complain }; | 244 enum InvalidURLAction { DoNothing, Complain }; |
| 245 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 245 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 246 | 246 |
| 247 // Checks to see if current media data is CORS-same-origin as the | 247 // Checks to see if current media data is CORS-same-origin as the |
| 248 // specified origin. | 248 // specified origin. |
| 249 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 249 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
| 250 | 250 |
| 251 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); | 251 void scheduleEvent(RawPtr<Event>); |
| 252 void scheduleTimeupdateEvent(bool periodicEvent); | 252 void scheduleTimeupdateEvent(bool periodicEvent); |
| 253 | 253 |
| 254 // Returns the "effective media volume" value as specified in the HTML5 spec
. | 254 // Returns the "effective media volume" value as specified in the HTML5 spec
. |
| 255 double effectiveMediaVolume() const; | 255 double effectiveMediaVolume() const; |
| 256 | 256 |
| 257 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF
or] IDL attribute usage.) | 257 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF
or] IDL attribute usage.) |
| 258 virtual bool isHTMLAudioElement() const { return false; } | 258 virtual bool isHTMLAudioElement() const { return false; } |
| 259 virtual bool isHTMLVideoElement() const { return false; } | 259 virtual bool isHTMLVideoElement() const { return false; } |
| 260 | 260 |
| 261 // Temporary callback for crbug.com/487345,402044 | 261 // Temporary callback for crbug.com/487345,402044 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 void resolvePlayPromises(); | 462 void resolvePlayPromises(); |
| 463 // TODO(mlamouri): this is used for cancellable tasks because we can't pass | 463 // TODO(mlamouri): this is used for cancellable tasks because we can't pass |
| 464 // parameters. | 464 // parameters. |
| 465 void rejectPlayPromises(); | 465 void rejectPlayPromises(); |
| 466 void rejectPlayPromises(ExceptionCode, const String&); | 466 void rejectPlayPromises(ExceptionCode, const String&); |
| 467 | 467 |
| 468 UnthrottledTimer<HTMLMediaElement> m_loadTimer; | 468 UnthrottledTimer<HTMLMediaElement> m_loadTimer; |
| 469 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; | 469 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; |
| 470 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; | 470 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; |
| 471 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; | 471 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; |
| 472 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; | 472 Member<TimeRanges> m_playedTimeRanges; |
| 473 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 473 Member<GenericEventQueue> m_asyncEventQueue; |
| 474 | 474 |
| 475 double m_playbackRate; | 475 double m_playbackRate; |
| 476 double m_defaultPlaybackRate; | 476 double m_defaultPlaybackRate; |
| 477 NetworkState m_networkState; | 477 NetworkState m_networkState; |
| 478 ReadyState m_readyState; | 478 ReadyState m_readyState; |
| 479 ReadyState m_readyStateMaximum; | 479 ReadyState m_readyStateMaximum; |
| 480 KURL m_currentSrc; | 480 KURL m_currentSrc; |
| 481 | 481 |
| 482 PersistentWillBeMember<MediaError> m_error; | 482 Member<MediaError> m_error; |
| 483 | 483 |
| 484 double m_volume; | 484 double m_volume; |
| 485 double m_lastSeekTime; | 485 double m_lastSeekTime; |
| 486 | 486 |
| 487 double m_previousProgressTime; | 487 double m_previousProgressTime; |
| 488 | 488 |
| 489 // Cached duration to suppress duplicate events if duration unchanged. | 489 // Cached duration to suppress duplicate events if duration unchanged. |
| 490 double m_duration; | 490 double m_duration; |
| 491 | 491 |
| 492 // The last time a timeupdate event was sent (wall clock). | 492 // The last time a timeupdate event was sent (wall clock). |
| 493 double m_lastTimeUpdateEventWallTime; | 493 double m_lastTimeUpdateEventWallTime; |
| 494 | 494 |
| 495 // The last time a timeupdate event was sent in movie time. | 495 // The last time a timeupdate event was sent in movie time. |
| 496 double m_lastTimeUpdateEventMovieTime; | 496 double m_lastTimeUpdateEventMovieTime; |
| 497 | 497 |
| 498 // The default playback start position. | 498 // The default playback start position. |
| 499 double m_defaultPlaybackStartPosition; | 499 double m_defaultPlaybackStartPosition; |
| 500 | 500 |
| 501 // Loading state. | 501 // Loading state. |
| 502 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; | 502 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; |
| 503 LoadState m_loadState; | 503 LoadState m_loadState; |
| 504 RefPtrWillBeMember<HTMLSourceElement> m_currentSourceNode; | 504 Member<HTMLSourceElement> m_currentSourceNode; |
| 505 RefPtrWillBeMember<Node> m_nextChildNodeToConsider; | 505 Member<Node> m_nextChildNodeToConsider; |
| 506 | 506 |
| 507 // "Deferred loading" state (for preload=none). | 507 // "Deferred loading" state (for preload=none). |
| 508 enum DeferredLoadState { | 508 enum DeferredLoadState { |
| 509 // The load is not deferred. | 509 // The load is not deferred. |
| 510 NotDeferred, | 510 NotDeferred, |
| 511 // The load is deferred, and waiting for the task to set the | 511 // The load is deferred, and waiting for the task to set the |
| 512 // delaying-the-load-event flag (to false). | 512 // delaying-the-load-event flag (to false). |
| 513 WaitingForStopDelayingLoadEventTask, | 513 WaitingForStopDelayingLoadEventTask, |
| 514 // The load is the deferred, and waiting for a triggering event. | 514 // The load is the deferred, and waiting for a triggering event. |
| 515 WaitingForTrigger, | 515 WaitingForTrigger, |
| 516 // The load is deferred, and waiting for the task to set the | 516 // The load is deferred, and waiting for the task to set the |
| 517 // delaying-the-load-event flag, after which the load will be executed. | 517 // delaying-the-load-event flag, after which the load will be executed. |
| 518 ExecuteOnStopDelayingLoadEventTask | 518 ExecuteOnStopDelayingLoadEventTask |
| 519 }; | 519 }; |
| 520 DeferredLoadState m_deferredLoadState; | 520 DeferredLoadState m_deferredLoadState; |
| 521 Timer<HTMLMediaElement> m_deferredLoadTimer; | 521 Timer<HTMLMediaElement> m_deferredLoadTimer; |
| 522 | 522 |
| 523 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | 523 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 524 WebLayer* m_webLayer; | 524 WebLayer* m_webLayer; |
| 525 | 525 |
| 526 DisplayMode m_displayMode; | 526 DisplayMode m_displayMode; |
| 527 | 527 |
| 528 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 528 Member<HTMLMediaSource> m_mediaSource; |
| 529 | 529 |
| 530 // Cached time value. Only valid when ready state is HAVE_METADATA or | 530 // Cached time value. Only valid when ready state is HAVE_METADATA or |
| 531 // higher, otherwise the current time is assumed to be zero. | 531 // higher, otherwise the current time is assumed to be zero. |
| 532 mutable double m_cachedTime; | 532 mutable double m_cachedTime; |
| 533 | 533 |
| 534 double m_fragmentEndTime; | 534 double m_fragmentEndTime; |
| 535 | 535 |
| 536 typedef unsigned PendingActionFlags; | 536 typedef unsigned PendingActionFlags; |
| 537 PendingActionFlags m_pendingActionFlags; | 537 PendingActionFlags m_pendingActionFlags; |
| 538 | 538 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 556 | 556 |
| 557 bool m_ignorePreloadNone : 1; | 557 bool m_ignorePreloadNone : 1; |
| 558 bool m_tracksAreReady : 1; | 558 bool m_tracksAreReady : 1; |
| 559 bool m_processingPreferenceChange : 1; | 559 bool m_processingPreferenceChange : 1; |
| 560 bool m_remoteRoutesAvailable : 1; | 560 bool m_remoteRoutesAvailable : 1; |
| 561 bool m_playingRemotely : 1; | 561 bool m_playingRemotely : 1; |
| 562 bool m_isFinalizing : 1; | 562 bool m_isFinalizing : 1; |
| 563 // Whether this element is in overlay fullscreen mode. | 563 // Whether this element is in overlay fullscreen mode. |
| 564 bool m_inOverlayFullscreenVideo : 1; | 564 bool m_inOverlayFullscreenVideo : 1; |
| 565 | 565 |
| 566 PersistentWillBeMember<AudioTrackList> m_audioTracks; | 566 Member<AudioTrackList> m_audioTracks; |
| 567 PersistentWillBeMember<VideoTrackList> m_videoTracks; | 567 Member<VideoTrackList> m_videoTracks; |
| 568 PersistentWillBeMember<TextTrackList> m_textTracks; | 568 Member<TextTrackList> m_textTracks; |
| 569 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso
urceSelectionBegan; | 569 HeapVector<Member<TextTrack>> m_textTracksWhenResourceSelectionBegan; |
| 570 | 570 |
| 571 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 571 Member<CueTimeline> m_cueTimeline; |
| 572 | 572 |
| 573 PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playRe
solvers; | 573 HeapVector<Member<ScriptPromiseResolver>> m_playResolvers; |
| 574 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; | 574 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; |
| 575 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; | 575 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; |
| 576 ExceptionCode m_playPromiseErrorCode; | 576 ExceptionCode m_playPromiseErrorCode; |
| 577 | 577 |
| 578 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 578 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
| 579 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. | 579 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. |
| 580 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 580 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 581 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 581 WeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 582 | 582 |
| 583 // AudioClientImpl wraps an AudioSourceProviderClient. | 583 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 584 // When the audio format is known, Chromium calls setFormat(). | 584 // When the audio format is known, Chromium calls setFormat(). |
| 585 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { | 585 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
| 586 public: | 586 public: |
| 587 explicit AudioClientImpl(AudioSourceProviderClient* client) | 587 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 588 : m_client(client) | 588 : m_client(client) |
| 589 { | 589 { |
| 590 } | 590 } |
| 591 | 591 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 616 void wrap(WebAudioSourceProvider*); | 616 void wrap(WebAudioSourceProvider*); |
| 617 | 617 |
| 618 // AudioSourceProvider | 618 // AudioSourceProvider |
| 619 void setClient(AudioSourceProviderClient*) override; | 619 void setClient(AudioSourceProviderClient*) override; |
| 620 void provideInput(AudioBus*, size_t framesToProcess) override; | 620 void provideInput(AudioBus*, size_t framesToProcess) override; |
| 621 | 621 |
| 622 DECLARE_TRACE(); | 622 DECLARE_TRACE(); |
| 623 | 623 |
| 624 private: | 624 private: |
| 625 WebAudioSourceProvider* m_webAudioSourceProvider; | 625 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 626 PersistentWillBeMember<AudioClientImpl> m_client; | 626 Member<AudioClientImpl> m_client; |
| 627 Mutex provideInputLock; | 627 Mutex provideInputLock; |
| 628 }; | 628 }; |
| 629 | 629 |
| 630 AudioSourceProviderImpl m_audioSourceProvider; | 630 AudioSourceProviderImpl m_audioSourceProvider; |
| 631 | 631 |
| 632 class AutoplayHelperClientImpl; | 632 class AutoplayHelperClientImpl; |
| 633 | 633 |
| 634 friend class Internals; | 634 friend class Internals; |
| 635 friend class TrackDisplayUpdateScope; | 635 friend class TrackDisplayUpdateScope; |
| 636 friend class AutoplayExperimentHelper; | 636 friend class AutoplayExperimentHelper; |
| 637 friend class MediaControlsTest; | 637 friend class MediaControlsTest; |
| 638 | 638 |
| 639 OwnPtrWillBeMember<AutoplayExperimentHelper::Client> m_autoplayHelperClient; | 639 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; |
| 640 OwnPtrWillBeMember<AutoplayExperimentHelper> m_autoplayHelper; | 640 Member<AutoplayExperimentHelper> m_autoplayHelper; |
| 641 | 641 |
| 642 WebRemotePlaybackClient* m_remotePlaybackClient; | 642 WebRemotePlaybackClient* m_remotePlaybackClient; |
| 643 | 643 |
| 644 static URLRegistry* s_mediaStreamRegistry; | 644 static URLRegistry* s_mediaStreamRegistry; |
| 645 }; | 645 }; |
| 646 | 646 |
| 647 inline bool isHTMLMediaElement(const HTMLElement& element) | 647 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 648 { | 648 { |
| 649 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 649 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 650 } | 650 } |
| 651 | 651 |
| 652 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 652 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 653 | 653 |
| 654 } // namespace blink | 654 } // namespace blink |
| 655 | 655 |
| 656 #endif // HTMLMediaElement_h | 656 #endif // HTMLMediaElement_h |
| OLD | NEW |