Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.h

Issue 2425463002: Improve HTMLMediaElement::currentTime() (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 bool couldPlayIfEnoughData() const; 458 bool couldPlayIfEnoughData() const;
459 459
460 // Generally the presence of the loop attribute should be considered to mean 460 // Generally the presence of the loop attribute should be considered to mean
461 // playback has not "ended", as "ended" and "looping" are mutually exclusive. 461 // playback has not "ended", as "ended" and "looping" are mutually exclusive.
462 // See 462 // See
463 // https://html.spec.whatwg.org/multipage/embedded-content.html#ended-playback 463 // https://html.spec.whatwg.org/multipage/embedded-content.html#ended-playback
464 enum class LoopCondition { Included, Ignored }; 464 enum class LoopCondition { Included, Ignored };
465 bool endedPlayback(LoopCondition = LoopCondition::Included) const; 465 bool endedPlayback(LoopCondition = LoopCondition::Included) const;
466 466
467 void setShouldDelayLoadEvent(bool); 467 void setShouldDelayLoadEvent(bool);
468 void invalidateCachedTime(); 468
469 void refreshCachedTime() const; 469 double earliestPossiblePosition() const;
470 double currentPlaybackPosition() const;
471 double officialPlaybackPosition() const;
472 void setOfficialPlaybackPosition(double) const;
473 void requireOfficialPlaybackPositionUpdate() const;
470 474
471 void ensureMediaControls(); 475 void ensureMediaControls();
472 void configureMediaControls(); 476 void configureMediaControls();
473 477
474 TextTrackContainer& ensureTextTrackContainer(); 478 TextTrackContainer& ensureTextTrackContainer();
475 479
476 EventDispatchHandlingState* preDispatchEventHandler(Event*) final; 480 EventDispatchHandlingState* preDispatchEventHandler(Event*) final;
477 481
478 void changeNetworkStateFromLoadingToIdle(); 482 void changeNetworkStateFromLoadingToIdle();
479 483
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 562
559 double m_previousProgressTime; 563 double m_previousProgressTime;
560 564
561 // Cached duration to suppress duplicate events if duration unchanged. 565 // Cached duration to suppress duplicate events if duration unchanged.
562 double m_duration; 566 double m_duration;
563 567
564 // The last time a timeupdate event was sent (wall clock). 568 // The last time a timeupdate event was sent (wall clock).
565 double m_lastTimeUpdateEventWallTime; 569 double m_lastTimeUpdateEventWallTime;
566 570
567 // The last time a timeupdate event was sent in movie time. 571 // The last time a timeupdate event was sent in movie time.
568 double m_lastTimeUpdateEventMovieTime; 572 double m_lastTimeUpdateEventMediaTime;
569 573
570 // The default playback start position. 574 // The default playback start position.
571 double m_defaultPlaybackStartPosition; 575 double m_defaultPlaybackStartPosition;
572 576
573 // Loading state. 577 // Loading state.
574 enum LoadState { 578 enum LoadState {
575 WaitingForSource, 579 WaitingForSource,
576 LoadingFromSrcObject, 580 LoadingFromSrcObject,
577 LoadingFromSrcAttr, 581 LoadingFromSrcAttr,
578 LoadingFromSourceElement 582 LoadingFromSourceElement
(...skipping 18 matching lines...) Expand all
597 DeferredLoadState m_deferredLoadState; 601 DeferredLoadState m_deferredLoadState;
598 Timer<HTMLMediaElement> m_deferredLoadTimer; 602 Timer<HTMLMediaElement> m_deferredLoadTimer;
599 603
600 std::unique_ptr<WebMediaPlayer> m_webMediaPlayer; 604 std::unique_ptr<WebMediaPlayer> m_webMediaPlayer;
601 WebLayer* m_webLayer; 605 WebLayer* m_webLayer;
602 606
603 DisplayMode m_displayMode; 607 DisplayMode m_displayMode;
604 608
605 Member<HTMLMediaSource> m_mediaSource; 609 Member<HTMLMediaSource> m_mediaSource;
606 610
607 // Cached time value. Only valid when ready state is kHaveMetadata or 611 // Stores "official playback position", updated periodically from "current
608 // higher, otherwise the current time is assumed to be zero. 612 // playback position". Official playback position should not change while
609 mutable double m_cachedTime; 613 // scripts are running. See setOfficialPlaybackPosition().
614 mutable double m_officialPlaybackPosition;
615 mutable bool m_officialPlaybackPositionNeedsUpdate;
610 616
611 double m_fragmentEndTime; 617 double m_fragmentEndTime;
612 618
613 typedef unsigned PendingActionFlags; 619 typedef unsigned PendingActionFlags;
614 PendingActionFlags m_pendingActionFlags; 620 PendingActionFlags m_pendingActionFlags;
615 621
616 // FIXME: HTMLMediaElement has way too many state bits. 622 // FIXME: HTMLMediaElement has way too many state bits.
617 bool m_lockedPendingUserGesture : 1; 623 bool m_lockedPendingUserGesture : 1;
618 bool m_playing : 1; 624 bool m_playing : 1;
619 bool m_shouldDelayLoadEvent : 1; 625 bool m_shouldDelayLoadEvent : 1;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 733
728 inline bool isHTMLMediaElement(const HTMLElement& element) { 734 inline bool isHTMLMediaElement(const HTMLElement& element) {
729 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 735 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
730 } 736 }
731 737
732 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 738 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
733 739
734 } // namespace blink 740 } // namespace blink
735 741
736 #endif // HTMLMediaElement_h 742 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698