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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 void attach(const AttachContext& = AttachContext()) override; | 273 void attach(const AttachContext& = AttachContext()) override; |
274 | 274 |
275 void didMoveToNewDocument(Document& oldDocument) override; | 275 void didMoveToNewDocument(Document& oldDocument) override; |
276 virtual KURL posterImageURL() const { return KURL(); } | 276 virtual KURL posterImageURL() const { return KURL(); } |
277 | 277 |
278 enum DisplayMode { Unknown, Poster, Video }; | 278 enum DisplayMode { Unknown, Poster, Video }; |
279 DisplayMode getDisplayMode() const { return m_displayMode; } | 279 DisplayMode getDisplayMode() const { return m_displayMode; } |
280 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 280 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
281 | 281 |
282 private: | 282 private: |
| 283 class Task; |
| 284 |
283 void resetMediaPlayerAndMediaSource(); | 285 void resetMediaPlayerAndMediaSource(); |
284 | 286 |
285 bool alwaysCreateUserAgentShadowRoot() const final { return true; } | 287 bool alwaysCreateUserAgentShadowRoot() const final { return true; } |
286 bool areAuthorShadowsAllowed() const final { return false; } | 288 bool areAuthorShadowsAllowed() const final { return false; } |
287 | 289 |
288 bool supportsFocus() const final; | 290 bool supportsFocus() const final; |
289 bool isMouseFocusable() const final; | 291 bool isMouseFocusable() const final; |
290 bool layoutObjectIsNeeded(const ComputedStyle&) override; | 292 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
291 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 293 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
292 InsertionNotificationRequest insertedInto(ContainerNode*) final; | 294 InsertionNotificationRequest insertedInto(ContainerNode*) final; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlayerClient
::VideoTrackKind, const WebString&, const WebString&, bool) final; | 326 WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlayerClient
::VideoTrackKind, const WebString&, const WebString&, bool) final; |
325 void removeVideoTrack(WebMediaPlayer::TrackId) final; | 327 void removeVideoTrack(WebMediaPlayer::TrackId) final; |
326 void addTextTrack(WebInbandTextTrack*) final; | 328 void addTextTrack(WebInbandTextTrack*) final; |
327 void removeTextTrack(WebInbandTextTrack*) final; | 329 void removeTextTrack(WebInbandTextTrack*) final; |
328 void mediaSourceOpened(WebMediaSource*) final; | 330 void mediaSourceOpened(WebMediaSource*) final; |
329 void requestSeek(double) final; | 331 void requestSeek(double) final; |
330 void remoteRouteAvailabilityChanged(bool) final; | 332 void remoteRouteAvailabilityChanged(bool) final; |
331 void connectedToRemoteDevice() final; | 333 void connectedToRemoteDevice() final; |
332 void disconnectedFromRemoteDevice() final; | 334 void disconnectedFromRemoteDevice() final; |
333 | 335 |
334 void loadTimerFired(Timer<HTMLMediaElement>*); | 336 void textTrackLoadTimerFired(Timer<HTMLMediaElement>*); |
335 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 337 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
336 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 338 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
337 void startPlaybackProgressTimer(); | 339 void startPlaybackProgressTimer(); |
338 void startProgressEventTimer(); | 340 void startProgressEventTimer(); |
339 void stopPeriodicTimers(); | 341 void stopPeriodicTimers(); |
340 | 342 |
341 void seek(double time); | 343 void seek(double time); |
342 void finishSeek(); | 344 void finishSeek(); |
343 void checkIfSeekNeeded(); | 345 void checkIfSeekNeeded(); |
344 void addPlayedRange(double start, double end); | 346 void addPlayedRange(double start, double end); |
345 | 347 |
346 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched
uleNamedEvent for clarity. | 348 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched
uleNamedEvent for clarity. |
347 | 349 |
348 // loading | 350 // loading |
349 void invokeLoadAlgorithm(); | 351 void invokeLoadAlgorithm(); |
350 void invokeResourceSelectionAlgorithm(); | 352 void invokeResourceSelectionAlgorithm(); |
| 353 void continueResourceSelectionAlgorithm(); |
| 354 void enqueueMicrotask(); |
351 void loadInternal(); | 355 void loadInternal(); |
352 void selectMediaResource(); | 356 void selectMediaResource(); |
353 void loadResource(const KURL&, ContentType&); | 357 void loadResource(const KURL&, ContentType&); |
354 void startPlayerLoad(); | 358 void startPlayerLoad(); |
355 void setPlayerPreload(); | 359 void setPlayerPreload(); |
356 WebMediaPlayer::LoadType loadType() const; | 360 WebMediaPlayer::LoadType loadType() const; |
357 void scheduleNextSourceChild(); | |
358 void loadNextSourceChild(); | 361 void loadNextSourceChild(); |
359 void clearMediaPlayer(); | 362 void clearMediaPlayer(); |
360 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); | 363 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); |
361 bool havePotentialSourceChild(); | 364 bool havePotentialSourceChild(); |
362 void noneSupported(); | 365 void noneSupported(); |
363 void mediaEngineError(MediaError*); | 366 void mediaEngineError(MediaError*); |
364 void cancelPendingEventsAndCallbacks(); | 367 void cancelPendingEventsAndCallbacks(); |
365 void waitForSourceChange(); | 368 void waitForSourceChange(); |
366 void setIgnorePreloadNone(); | 369 void setIgnorePreloadNone(); |
367 | 370 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 void scheduleResolvePlayPromises(); | 461 void scheduleResolvePlayPromises(); |
459 void scheduleRejectPlayPromises(ExceptionCode); | 462 void scheduleRejectPlayPromises(ExceptionCode); |
460 void scheduleNotifyPlaying(); | 463 void scheduleNotifyPlaying(); |
461 | 464 |
462 void resolvePlayPromises(); | 465 void resolvePlayPromises(); |
463 // TODO(mlamouri): this is used for cancellable tasks because we can't pass | 466 // TODO(mlamouri): this is used for cancellable tasks because we can't pass |
464 // parameters. | 467 // parameters. |
465 void rejectPlayPromises(); | 468 void rejectPlayPromises(); |
466 void rejectPlayPromises(ExceptionCode, const String&); | 469 void rejectPlayPromises(ExceptionCode, const String&); |
467 | 470 |
468 UnthrottledTimer<HTMLMediaElement> m_loadTimer; | 471 UnthrottledTimer<HTMLMediaElement> m_textTrackLoadTimer; |
469 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; | 472 UnthrottledTimer<HTMLMediaElement> m_progressEventTimer; |
470 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; | 473 UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer; |
471 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; | 474 UnthrottledTimer<HTMLMediaElement> m_audioTracksTimer; |
472 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; | 475 PersistentWillBeMember<TimeRanges> m_playedTimeRanges; |
473 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 476 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
474 | 477 |
475 double m_playbackRate; | 478 double m_playbackRate; |
476 double m_defaultPlaybackRate; | 479 double m_defaultPlaybackRate; |
477 NetworkState m_networkState; | 480 NetworkState m_networkState; |
478 ReadyState m_readyState; | 481 ReadyState m_readyState; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 DisplayMode m_displayMode; | 529 DisplayMode m_displayMode; |
527 | 530 |
528 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 531 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; |
529 | 532 |
530 // Cached time value. Only valid when ready state is HAVE_METADATA or | 533 // Cached time value. Only valid when ready state is HAVE_METADATA or |
531 // higher, otherwise the current time is assumed to be zero. | 534 // higher, otherwise the current time is assumed to be zero. |
532 mutable double m_cachedTime; | 535 mutable double m_cachedTime; |
533 | 536 |
534 double m_fragmentEndTime; | 537 double m_fragmentEndTime; |
535 | 538 |
536 typedef unsigned PendingActionFlags; | |
537 PendingActionFlags m_pendingActionFlags; | |
538 | |
539 // FIXME: HTMLMediaElement has way too many state bits. | 539 // FIXME: HTMLMediaElement has way too many state bits. |
540 bool m_userGestureRequiredForPlay : 1; | 540 bool m_userGestureRequiredForPlay : 1; |
541 bool m_playing : 1; | 541 bool m_playing : 1; |
542 bool m_shouldDelayLoadEvent : 1; | 542 bool m_shouldDelayLoadEvent : 1; |
543 bool m_haveFiredLoadedData : 1; | 543 bool m_haveFiredLoadedData : 1; |
544 bool m_autoplaying : 1; | 544 bool m_autoplaying : 1; |
545 bool m_muted : 1; | 545 bool m_muted : 1; |
546 bool m_paused : 1; | 546 bool m_paused : 1; |
547 bool m_seeking : 1; | 547 bool m_seeking : 1; |
548 | 548 |
(...skipping 26 matching lines...) Expand all Loading... |
575 PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playRe
solvers; | 575 PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playRe
solvers; |
576 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; | 576 OwnPtr<CancellableTaskFactory> m_playPromiseResolveTask; |
577 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; | 577 OwnPtr<CancellableTaskFactory> m_playPromiseRejectTask; |
578 ExceptionCode m_playPromiseErrorCode; | 578 ExceptionCode m_playPromiseErrorCode; |
579 | 579 |
580 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 580 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
581 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. | 581 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. |
582 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 582 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
583 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 583 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
584 | 584 |
| 585 WeakPtr<Task> m_pendingTask; // owned by Microtask |
| 586 |
585 // AudioClientImpl wraps an AudioSourceProviderClient. | 587 // AudioClientImpl wraps an AudioSourceProviderClient. |
586 // When the audio format is known, Chromium calls setFormat(). | 588 // When the audio format is known, Chromium calls setFormat(). |
587 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { | 589 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
588 public: | 590 public: |
589 explicit AudioClientImpl(AudioSourceProviderClient* client) | 591 explicit AudioClientImpl(AudioSourceProviderClient* client) |
590 : m_client(client) | 592 : m_client(client) |
591 { | 593 { |
592 } | 594 } |
593 | 595 |
594 ~AudioClientImpl() override { } | 596 ~AudioClientImpl() override { } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 inline bool isHTMLMediaElement(const HTMLElement& element) | 646 inline bool isHTMLMediaElement(const HTMLElement& element) |
645 { | 647 { |
646 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 648 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
647 } | 649 } |
648 | 650 |
649 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 651 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
650 | 652 |
651 } // namespace blink | 653 } // namespace blink |
652 | 654 |
653 #endif // HTMLMediaElement_h | 655 #endif // HTMLMediaElement_h |
OLD | NEW |