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

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

Issue 2425463002: Improve HTMLMediaElement::currentTime() (Closed)
Patch Set: comment fix 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 DeferredLoadState m_deferredLoadState; 603 DeferredLoadState m_deferredLoadState;
600 Timer<HTMLMediaElement> m_deferredLoadTimer; 604 Timer<HTMLMediaElement> m_deferredLoadTimer;
601 605
602 std::unique_ptr<WebMediaPlayer> m_webMediaPlayer; 606 std::unique_ptr<WebMediaPlayer> m_webMediaPlayer;
603 WebLayer* m_webLayer; 607 WebLayer* m_webLayer;
604 608
605 DisplayMode m_displayMode; 609 DisplayMode m_displayMode;
606 610
607 Member<HTMLMediaSource> m_mediaSource; 611 Member<HTMLMediaSource> m_mediaSource;
608 612
609 // Cached time value. Only valid when ready state is kHaveMetadata or 613 // Stores "official playback position", updated periodically from "current
610 // higher, otherwise the current time is assumed to be zero. 614 // playback position". Official playback position should not change while
611 mutable double m_cachedTime; 615 // scripts are running. See setOfficialPlaybackPosition().
616 mutable double m_officialPlaybackPosition;
617 mutable bool m_officialPlaybackPositionNeedsUpdate;
mlamouri (slow - plz ping) 2016/10/26 15:32:54 Why are these mutable?
chcunningham 2016/10/26 19:29:41 Just like with m_cachedTime, these variables end u
612 618
613 double m_fragmentEndTime; 619 double m_fragmentEndTime;
614 620
615 typedef unsigned PendingActionFlags; 621 typedef unsigned PendingActionFlags;
616 PendingActionFlags m_pendingActionFlags; 622 PendingActionFlags m_pendingActionFlags;
617 623
618 // FIXME: HTMLMediaElement has way too many state bits. 624 // FIXME: HTMLMediaElement has way too many state bits.
619 bool m_lockedPendingUserGesture : 1; 625 bool m_lockedPendingUserGesture : 1;
620 bool m_playing : 1; 626 bool m_playing : 1;
621 bool m_shouldDelayLoadEvent : 1; 627 bool m_shouldDelayLoadEvent : 1;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 735
730 inline bool isHTMLMediaElement(const HTMLElement& element) { 736 inline bool isHTMLMediaElement(const HTMLElement& element) {
731 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 737 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
732 } 738 }
733 739
734 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 740 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
735 741
736 } // namespace blink 742 } // namespace blink
737 743
738 #endif // HTMLMediaElement_h 744 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698