| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class HTMLMediaSource; | 54 class HTMLMediaSource; |
| 55 class TextTrackContainer; | 55 class TextTrackContainer; |
| 56 class TextTrackList; | 56 class TextTrackList; |
| 57 class TimeRanges; | 57 class TimeRanges; |
| 58 class URLRegistry; | 58 class URLRegistry; |
| 59 class VideoTrackList; | 59 class VideoTrackList; |
| 60 class WebAudioSourceProvider; | 60 class WebAudioSourceProvider; |
| 61 class WebInbandTextTrack; | 61 class WebInbandTextTrack; |
| 62 class WebLayer; | 62 class WebLayer; |
| 63 | 63 |
| 64 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple
mentable<HTMLMediaElement>, public ActiveDOMObject, private WebMediaPlayerClient
{ | 64 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public HeapSupplementab
le<HTMLMediaElement>, public ActiveDOMObject, private WebMediaPlayerClient { |
| 65 DEFINE_WRAPPERTYPEINFO(); | 65 DEFINE_WRAPPERTYPEINFO(); |
| 66 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); | 66 USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); |
| 67 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); | 67 USING_PRE_FINALIZER(HTMLMediaElement, dispose); |
| 68 public: | 68 public: |
| 69 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const
String& keySystem = String()); | 69 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const
String& keySystem = String()); |
| 70 | 70 |
| 71 static void setMediaStreamRegistry(URLRegistry*); | 71 static void setMediaStreamRegistry(URLRegistry*); |
| 72 static bool isMediaStreamURL(const String& url); | 72 static bool isMediaStreamURL(const String& url); |
| 73 | 73 |
| 74 DECLARE_VIRTUAL_TRACE(); | 74 DECLARE_VIRTUAL_TRACE(); |
| 75 void clearWeakMembers(Visitor*); | 75 void clearWeakMembers(Visitor*); |
| 76 WebMediaPlayer* webMediaPlayer() const | 76 WebMediaPlayer* webMediaPlayer() const |
| 77 { | 77 { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 AudioSourceProvider& audioSourceProvider() { return m_audioSourceProvider; } | 231 AudioSourceProvider& audioSourceProvider() { return m_audioSourceProvider; } |
| 232 | 232 |
| 233 enum InvalidURLAction { DoNothing, Complain }; | 233 enum InvalidURLAction { DoNothing, Complain }; |
| 234 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 234 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 235 | 235 |
| 236 // Checks to see if current media data is CORS-same-origin as the | 236 // Checks to see if current media data is CORS-same-origin as the |
| 237 // specified origin. | 237 // specified origin. |
| 238 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 238 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
| 239 | 239 |
| 240 void scheduleEvent(PassRefPtrWillBeRawPtr<Event>); | 240 void scheduleEvent(RawPtr<Event>); |
| 241 void scheduleTimeupdateEvent(bool periodicEvent); | 241 void scheduleTimeupdateEvent(bool periodicEvent); |
| 242 | 242 |
| 243 // Returns the "effective media volume" value as specified in the HTML5 spec
. | 243 // Returns the "effective media volume" value as specified in the HTML5 spec
. |
| 244 double effectiveMediaVolume() const; | 244 double effectiveMediaVolume() const; |
| 245 | 245 |
| 246 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF
or] IDL attribute usage.) | 246 // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapF
or] IDL attribute usage.) |
| 247 virtual bool isHTMLAudioElement() const { return false; } | 247 virtual bool isHTMLAudioElement() const { return false; } |
| 248 virtual bool isHTMLVideoElement() const { return false; } | 248 virtual bool isHTMLVideoElement() const { return false; } |
| 249 | 249 |
| 250 // Temporary callback for crbug.com/487345,402044 | 250 // Temporary callback for crbug.com/487345,402044 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 442 |
| 443 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 443 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
| 444 | 444 |
| 445 // TODO(liberato): remove once autoplay gesture override experiment conclude
s. | 445 // TODO(liberato): remove once autoplay gesture override experiment conclude
s. |
| 446 void triggerAutoplayViewportCheckForTesting(); | 446 void triggerAutoplayViewportCheckForTesting(); |
| 447 | 447 |
| 448 UnthrottledTimer<HTMLMediaElement> m_loadTimer; | 448 UnthrottledTimer<HTMLMediaElement> m_loadTimer; |
| 449 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; | 449 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; |
| 450 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; | 450 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; |
| 451 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; | 451 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; |
| 452 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; | 452 Member<TimeRanges> m_playedTimeRanges; |
| 453 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 453 Member<GenericEventQueue> m_asyncEventQueue; |
| 454 | 454 |
| 455 double m_playbackRate; | 455 double m_playbackRate; |
| 456 double m_defaultPlaybackRate; | 456 double m_defaultPlaybackRate; |
| 457 NetworkState m_networkState; | 457 NetworkState m_networkState; |
| 458 ReadyState m_readyState; | 458 ReadyState m_readyState; |
| 459 ReadyState m_readyStateMaximum; | 459 ReadyState m_readyStateMaximum; |
| 460 KURL m_currentSrc; | 460 KURL m_currentSrc; |
| 461 | 461 |
| 462 PersistentWillBeMember<MediaError> m_error; | 462 Member<MediaError> m_error; |
| 463 | 463 |
| 464 double m_volume; | 464 double m_volume; |
| 465 double m_lastSeekTime; | 465 double m_lastSeekTime; |
| 466 | 466 |
| 467 double m_previousProgressTime; | 467 double m_previousProgressTime; |
| 468 | 468 |
| 469 // Cached duration to suppress duplicate events if duration unchanged. | 469 // Cached duration to suppress duplicate events if duration unchanged. |
| 470 double m_duration; | 470 double m_duration; |
| 471 | 471 |
| 472 // The last time a timeupdate event was sent (wall clock). | 472 // The last time a timeupdate event was sent (wall clock). |
| 473 double m_lastTimeUpdateEventWallTime; | 473 double m_lastTimeUpdateEventWallTime; |
| 474 | 474 |
| 475 // The last time a timeupdate event was sent in movie time. | 475 // The last time a timeupdate event was sent in movie time. |
| 476 double m_lastTimeUpdateEventMovieTime; | 476 double m_lastTimeUpdateEventMovieTime; |
| 477 | 477 |
| 478 // The default playback start position. | 478 // The default playback start position. |
| 479 double m_defaultPlaybackStartPosition; | 479 double m_defaultPlaybackStartPosition; |
| 480 | 480 |
| 481 // Loading state. | 481 // Loading state. |
| 482 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; | 482 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; |
| 483 LoadState m_loadState; | 483 LoadState m_loadState; |
| 484 RefPtrWillBeMember<HTMLSourceElement> m_currentSourceNode; | 484 Member<HTMLSourceElement> m_currentSourceNode; |
| 485 RefPtrWillBeMember<Node> m_nextChildNodeToConsider; | 485 Member<Node> m_nextChildNodeToConsider; |
| 486 | 486 |
| 487 // "Deferred loading" state (for preload=none). | 487 // "Deferred loading" state (for preload=none). |
| 488 enum DeferredLoadState { | 488 enum DeferredLoadState { |
| 489 // The load is not deferred. | 489 // The load is not deferred. |
| 490 NotDeferred, | 490 NotDeferred, |
| 491 // The load is deferred, and waiting for the task to set the | 491 // The load is deferred, and waiting for the task to set the |
| 492 // delaying-the-load-event flag (to false). | 492 // delaying-the-load-event flag (to false). |
| 493 WaitingForStopDelayingLoadEventTask, | 493 WaitingForStopDelayingLoadEventTask, |
| 494 // The load is the deferred, and waiting for a triggering event. | 494 // The load is the deferred, and waiting for a triggering event. |
| 495 WaitingForTrigger, | 495 WaitingForTrigger, |
| 496 // The load is deferred, and waiting for the task to set the | 496 // The load is deferred, and waiting for the task to set the |
| 497 // delaying-the-load-event flag, after which the load will be executed. | 497 // delaying-the-load-event flag, after which the load will be executed. |
| 498 ExecuteOnStopDelayingLoadEventTask | 498 ExecuteOnStopDelayingLoadEventTask |
| 499 }; | 499 }; |
| 500 DeferredLoadState m_deferredLoadState; | 500 DeferredLoadState m_deferredLoadState; |
| 501 Timer<HTMLMediaElement> m_deferredLoadTimer; | 501 Timer<HTMLMediaElement> m_deferredLoadTimer; |
| 502 | 502 |
| 503 OwnPtr<WebMediaPlayer> m_webMediaPlayer; | 503 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 504 WebLayer* m_webLayer; | 504 WebLayer* m_webLayer; |
| 505 | 505 |
| 506 DisplayMode m_displayMode; | 506 DisplayMode m_displayMode; |
| 507 | 507 |
| 508 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 508 Member<HTMLMediaSource> m_mediaSource; |
| 509 | 509 |
| 510 // Cached time value. Only valid when ready state is HAVE_METADATA or | 510 // Cached time value. Only valid when ready state is HAVE_METADATA or |
| 511 // higher, otherwise the current time is assumed to be zero. | 511 // higher, otherwise the current time is assumed to be zero. |
| 512 mutable double m_cachedTime; | 512 mutable double m_cachedTime; |
| 513 | 513 |
| 514 double m_fragmentEndTime; | 514 double m_fragmentEndTime; |
| 515 | 515 |
| 516 typedef unsigned PendingActionFlags; | 516 typedef unsigned PendingActionFlags; |
| 517 PendingActionFlags m_pendingActionFlags; | 517 PendingActionFlags m_pendingActionFlags; |
| 518 | 518 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 542 bool m_haveVisibleTextTrack : 1; | 542 bool m_haveVisibleTextTrack : 1; |
| 543 bool m_processingPreferenceChange : 1; | 543 bool m_processingPreferenceChange : 1; |
| 544 bool m_remoteRoutesAvailable : 1; | 544 bool m_remoteRoutesAvailable : 1; |
| 545 bool m_playingRemotely : 1; | 545 bool m_playingRemotely : 1; |
| 546 bool m_isFinalizing : 1; | 546 bool m_isFinalizing : 1; |
| 547 bool m_initialPlayWithoutUserGesture : 1; | 547 bool m_initialPlayWithoutUserGesture : 1; |
| 548 bool m_autoplayMediaCounted : 1; | 548 bool m_autoplayMediaCounted : 1; |
| 549 // Whether this element is in overlay fullscreen mode. | 549 // Whether this element is in overlay fullscreen mode. |
| 550 bool m_inOverlayFullscreenVideo : 1; | 550 bool m_inOverlayFullscreenVideo : 1; |
| 551 | 551 |
| 552 PersistentWillBeMember<AudioTrackList> m_audioTracks; | 552 Member<AudioTrackList> m_audioTracks; |
| 553 PersistentWillBeMember<VideoTrackList> m_videoTracks; | 553 Member<VideoTrackList> m_videoTracks; |
| 554 PersistentWillBeMember<TextTrackList> m_textTracks; | 554 Member<TextTrackList> m_textTracks; |
| 555 PersistentHeapVectorWillBeHeapVector<Member<TextTrack>> m_textTracksWhenReso
urceSelectionBegan; | 555 HeapVector<Member<TextTrack>> m_textTracksWhenResourceSelectionBegan; |
| 556 | 556 |
| 557 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 557 Member<CueTimeline> m_cueTimeline; |
| 558 | 558 |
| 559 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 559 // 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. | 560 // 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") | 561 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 562 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 562 WeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 563 | 563 |
| 564 // AudioClientImpl wraps an AudioSourceProviderClient. | 564 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 565 // When the audio format is known, Chromium calls setFormat(). | 565 // When the audio format is known, Chromium calls setFormat(). |
| 566 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { | 566 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
| 567 public: | 567 public: |
| 568 explicit AudioClientImpl(AudioSourceProviderClient* client) | 568 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 569 : m_client(client) | 569 : m_client(client) |
| 570 { | 570 { |
| 571 } | 571 } |
| 572 | 572 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 597 void wrap(WebAudioSourceProvider*); | 597 void wrap(WebAudioSourceProvider*); |
| 598 | 598 |
| 599 // AudioSourceProvider | 599 // AudioSourceProvider |
| 600 void setClient(AudioSourceProviderClient*) override; | 600 void setClient(AudioSourceProviderClient*) override; |
| 601 void provideInput(AudioBus*, size_t framesToProcess) override; | 601 void provideInput(AudioBus*, size_t framesToProcess) override; |
| 602 | 602 |
| 603 DECLARE_TRACE(); | 603 DECLARE_TRACE(); |
| 604 | 604 |
| 605 private: | 605 private: |
| 606 WebAudioSourceProvider* m_webAudioSourceProvider; | 606 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 607 PersistentWillBeMember<AudioClientImpl> m_client; | 607 Member<AudioClientImpl> m_client; |
| 608 Mutex provideInputLock; | 608 Mutex provideInputLock; |
| 609 }; | 609 }; |
| 610 | 610 |
| 611 AudioSourceProviderImpl m_audioSourceProvider; | 611 AudioSourceProviderImpl m_audioSourceProvider; |
| 612 | 612 |
| 613 friend class Internals; | 613 friend class Internals; |
| 614 friend class TrackDisplayUpdateScope; | 614 friend class TrackDisplayUpdateScope; |
| 615 friend class AutoplayExperimentHelper; | 615 friend class AutoplayExperimentHelper; |
| 616 friend class MediaControlsTest; | 616 friend class MediaControlsTest; |
| 617 | 617 |
| 618 AutoplayExperimentHelper m_autoplayHelper; | 618 AutoplayExperimentHelper m_autoplayHelper; |
| 619 | 619 |
| 620 static URLRegistry* s_mediaStreamRegistry; | 620 static URLRegistry* s_mediaStreamRegistry; |
| 621 }; | 621 }; |
| 622 | 622 |
| 623 inline bool isHTMLMediaElement(const HTMLElement& element) | 623 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 624 { | 624 { |
| 625 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 625 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 626 } | 626 } |
| 627 | 627 |
| 628 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 628 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 629 | 629 |
| 630 } // namespace blink | 630 } // namespace blink |
| 631 | 631 |
| 632 #endif // HTMLMediaElement_h | 632 #endif // HTMLMediaElement_h |
| OLD | NEW |