Changeset 260736 in webkit
- Timestamp:
- Apr 26, 2020 6:02:58 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r260732 r260736 1 2020-04-26 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Rendering update steps should use Seconds for the timestamps 4 https://bugs.webkit.org/show_bug.cgi?id=210990 5 6 Reviewed by Daniel Bates. 7 8 Make DOMWindow::nowTimestamp() return ReducedResolutionSeconds and change 9 the callers accordingly. ReducedResolutionSeconds is a new type but it's 10 just an alias of the type Seconds. It indicates that the returned value 11 is a web-safe seconds. 12 13 * Headers.cmake: 14 * WebCore.xcodeproj/project.pbxproj: 15 * animation/DocumentTimeline.cpp: 16 (WebCore::DocumentTimeline::suspendAnimations): 17 (WebCore::DocumentTimeline::liveCurrentTime const): 18 (WebCore::DocumentTimeline::cacheCurrentTime): 19 (WebCore::DocumentTimeline::documentWillUpdateAnimationsAndSendEvents): 20 * animation/DocumentTimeline.h: 21 * animation/DocumentTimelinesController.cpp: 22 (WebCore::DocumentTimelinesController::updateAnimationsAndSendEvents): 23 * animation/DocumentTimelinesController.h: 24 * dom/Document.cpp: 25 (WebCore::Document::serviceRequestAnimationFrameCallbacks): 26 (WebCore::Document::updateIntersectionObservations): 27 * dom/Document.h: 28 * dom/ScriptedAnimationController.cpp: 29 (WebCore::ScriptedAnimationController::serviceRequestAnimationFrameCallbacks): 30 (WebCore::ScriptedAnimationController::scheduleAnimation): 31 * dom/ScriptedAnimationController.h: 32 * html/HTMLMediaElement.cpp: 33 (WebCore::HTMLMediaElement::getVideoPlaybackQuality): 34 * page/DOMWindow.cpp: 35 (WebCore::DOMWindow::nowTimestamp const): 36 * page/DOMWindow.h: 37 * page/IntersectionObserver.cpp: 38 (WebCore::IntersectionObserver::nowTimestamp const): 39 (WebCore::IntersectionObserver::createTimestamp const): Deleted. 40 * page/IntersectionObserver.h: 41 * page/Page.cpp: 42 (WebCore::Page::updateRendering): 43 * page/Performance.cpp: 44 (WebCore::Performance::now const): 45 (WebCore::Performance::nowInReducedResolutionSeconds const): 46 * page/Performance.h: 47 * page/ReducedResolutionSeconds.h: Added. 48 1 49 2020-04-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 50 -
trunk/Source/WebCore/Headers.cmake
r260724 r260736 841 841 page/ProcessWarming.h 842 842 page/Quirks.h 843 page/ReducedResolutionSeconds.h 843 844 page/RemoteDOMWindow.h 844 845 page/RemoteFrame.h -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r260729 r260736 1750 1750 556C7C4B22123997009B06CA /* RenderingUpdateScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 556C7C4722123942009B06CA /* RenderingUpdateScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1751 1751 5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1752 5584765A2453F334009F550C /* ReducedResolutionSeconds.h in Headers */ = {isa = PBXBuildFile; fileRef = 558476582453ABC2009F550C /* ReducedResolutionSeconds.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1752 1753 55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1753 1754 55AD093E2408963500DE4D2F /* DisplayListImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EA09F723FCCB3D008504A5 /* DisplayListImageBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8739 8740 5576A5621D88A70800CCC04C /* ImageFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageFrame.cpp; sourceTree = "<group>"; }; 8740 8741 5576A5631D88A70800CCC04C /* ImageFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageFrame.h; sourceTree = "<group>"; }; 8742 558476582453ABC2009F550C /* ReducedResolutionSeconds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ReducedResolutionSeconds.h; sourceTree = "<group>"; }; 8741 8743 5597FCCB2076C06800D35BB0 /* GlyphDisplayListCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphDisplayListCache.h; sourceTree = "<group>"; }; 8742 8744 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; }; … … 21078 21080 CD9A87F9215D6CF3006F17B5 /* Quirks.cpp */, 21079 21081 CD9A87FB215D6CF3006F17B5 /* Quirks.h */, 21082 558476582453ABC2009F550C /* ReducedResolutionSeconds.h */, 21080 21083 46B9518D207D632A00A7D2DD /* RemoteDOMWindow.cpp */, 21081 21084 46B9518E207D632A00A7D2DD /* RemoteDOMWindow.h */, … … 32429 32432 FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */, 32430 32433 5CEEE4361F5F8F210014A5F5 /* RectEdges.h in Headers */, 32434 5584765A2453F334009F550C /* ReducedResolutionSeconds.h in Headers */, 32431 32435 9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */, 32432 32436 BCAB418213E356E800D8AAF3 /* Region.h in Headers */, -
trunk/Source/WebCore/animation/DocumentTimeline.cpp
r260525 r260736 233 233 234 234 if (!m_cachedCurrentTime) 235 m_cachedCurrentTime = Seconds(liveCurrentTime());235 m_cachedCurrentTime = liveCurrentTime(); 236 236 237 237 for (const auto& animation : m_animations) … … 275 275 } 276 276 277 DOMHighResTimeStampDocumentTimeline::liveCurrentTime() const277 ReducedResolutionSeconds DocumentTimeline::liveCurrentTime() const 278 278 { 279 279 return m_document->domWindow()->nowTimestamp(); … … 298 298 } 299 299 300 void DocumentTimeline::cacheCurrentTime( DOMHighResTimeStampnewCurrentTime)300 void DocumentTimeline::cacheCurrentTime(ReducedResolutionSeconds newCurrentTime) 301 301 { 302 302 ASSERT(m_document); 303 303 304 m_cachedCurrentTime = Seconds(newCurrentTime);304 m_cachedCurrentTime = newCurrentTime; 305 305 // We want to be sure to keep this time cached until we've both finished running JS and finished updating 306 306 // animations, so we schedule the invalidation task and register a whenIdle callback on the VM, which will … … 362 362 } 363 363 364 DocumentTimeline::ShouldUpdateAnimationsAndSendEvents DocumentTimeline::documentWillUpdateAnimationsAndSendEvents( DOMHighResTimeStamptimestamp)364 DocumentTimeline::ShouldUpdateAnimationsAndSendEvents DocumentTimeline::documentWillUpdateAnimationsAndSendEvents(ReducedResolutionSeconds timestamp) 365 365 { 366 366 // We need to freeze the current time even if no animation is running. -
trunk/Source/WebCore/animation/DocumentTimeline.h
r260525 r260736 29 29 #include "DocumentTimelineOptions.h" 30 30 #include "GenericTaskQueue.h" 31 #include "ReducedResolutionSeconds.h" 31 32 #include "Timer.h" 32 33 #include <wtf/Markable.h> … … 75 76 76 77 enum class ShouldUpdateAnimationsAndSendEvents : uint8_t { Yes, No }; 77 ShouldUpdateAnimationsAndSendEvents documentWillUpdateAnimationsAndSendEvents( DOMHighResTimeStamp);78 ShouldUpdateAnimationsAndSendEvents documentWillUpdateAnimationsAndSendEvents(ReducedResolutionSeconds); 78 79 void removeReplacedAnimations(); 79 80 AnimationEvents prepareForPendingAnimationEventsDispatch(); … … 93 94 94 95 DocumentTimelinesController* controller() const; 95 DOMHighResTimeStampliveCurrentTime() const;96 ReducedResolutionSeconds liveCurrentTime() const; 96 97 void applyPendingAcceleratedAnimations(); 97 void cacheCurrentTime( DOMHighResTimeStamp);98 void cacheCurrentTime(ReducedResolutionSeconds); 98 99 void maybeClearCachedCurrentTime(); 99 100 void scheduleInvalidationTaskIfNeeded(); -
trunk/Source/WebCore/animation/DocumentTimelinesController.cpp
r260525 r260736 62 62 } 63 63 64 void DocumentTimelinesController::updateAnimationsAndSendEvents( DOMHighResTimeStamptimestamp)64 void DocumentTimelinesController::updateAnimationsAndSendEvents(ReducedResolutionSeconds timestamp) 65 65 { 66 66 ASSERT(!m_timelines.hasNullReferences()); -
trunk/Source/WebCore/animation/DocumentTimelinesController.h
r260525 r260736 26 26 #pragma once 27 27 28 #include " DOMHighResTimeStamp.h"28 #include "ReducedResolutionSeconds.h" 29 29 #include <wtf/WeakHashSet.h> 30 30 … … 45 45 void removeTimeline(DocumentTimeline&); 46 46 void detachFromDocument(); 47 void updateAnimationsAndSendEvents( DOMHighResTimeStamp);47 void updateAnimationsAndSendEvents(ReducedResolutionSeconds); 48 48 49 49 private: -
trunk/Source/WebCore/dom/Document.cpp
r260709 r260736 6372 6372 } 6373 6373 6374 void Document::serviceRequestAnimationFrameCallbacks( DOMHighResTimeStamptimestamp)6374 void Document::serviceRequestAnimationFrameCallbacks(ReducedResolutionSeconds timestamp) 6375 6375 { 6376 6376 if (m_scriptedAnimationController) … … 7623 7623 for (const auto& observer : m_intersectionObservers) { 7624 7624 bool needNotify = false; 7625 DOMHighResTimeStamp timestamp;7626 if (! observer->createTimestamp(timestamp))7625 auto timestamp = observer->nowTimestamp(); 7626 if (!timestamp) 7627 7627 continue; 7628 7628 for (Element* target : observer->observationTargets()) { … … 7677 7677 7678 7678 observer->appendQueuedEntry(IntersectionObserverEntry::create({ 7679 timestamp ,7679 timestamp->milliseconds(), 7680 7680 reportedRootBounds, 7681 7681 { targetBoundingClientRect.x(), targetBoundingClientRect.y(), targetBoundingClientRect.width(), targetBoundingClientRect.height() }, -
trunk/Source/WebCore/dom/Document.h
r260504 r260736 1081 1081 void resumeScriptedAnimationControllerCallbacks(); 1082 1082 1083 void serviceRequestAnimationFrameCallbacks( DOMHighResTimeStamp);1083 void serviceRequestAnimationFrameCallbacks(ReducedResolutionSeconds); 1084 1084 1085 1085 void windowScreenDidChange(PlatformDisplayID); -
trunk/Source/WebCore/dom/ScriptedAnimationController.cpp
r260140 r260736 194 194 } 195 195 196 void ScriptedAnimationController::serviceRequestAnimationFrameCallbacks( DOMHighResTimeStamptimestamp)196 void ScriptedAnimationController::serviceRequestAnimationFrameCallbacks(ReducedResolutionSeconds timestamp) 197 197 { 198 198 if (!m_callbacks.size() || m_suspendCount || !requestAnimationFrameEnabled()) … … 201 201 TraceScope tracingScope(RAFCallbackStart, RAFCallbackEnd); 202 202 203 auto highResNowMs = std::round(1000 * timestamp);203 auto highResNowMs = timestamp.milliseconds(); 204 204 if (m_document && m_document->quirks().needsMillisecondResolutionForHighResTimeStamp()) 205 205 highResNowMs += 0.1; … … 274 274 275 275 Seconds animationInterval = interval(); 276 Seconds scheduleDelay = std::max(animationInterval - Seconds(m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0_s);276 Seconds scheduleDelay = std::max(animationInterval - (m_document->domWindow()->nowTimestamp() - m_lastAnimationFrameTimestamp), 0_s); 277 277 278 278 if (isThrottled()) { -
trunk/Source/WebCore/dom/ScriptedAnimationController.h
r256512 r260736 54 54 CallbackId registerCallback(Ref<RequestAnimationFrameCallback>&&); 55 55 void cancelCallback(CallbackId); 56 void serviceRequestAnimationFrameCallbacks( DOMHighResTimeStamp timestamp);56 void serviceRequestAnimationFrameCallbacks(ReducedResolutionSeconds); 57 57 58 58 void suspend(); … … 87 87 88 88 Timer m_animationTimer; 89 doublem_lastAnimationFrameTimestamp { 0 };89 ReducedResolutionSeconds m_lastAnimationFrameTimestamp { 0 }; 90 90 91 91 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR) -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r260724 r260736 7111 7111 { 7112 7112 RefPtr<DOMWindow> domWindow = document().domWindow(); 7113 double timestamp = domWindow ? 1000 * domWindow->nowTimestamp() : 0;7113 double timestamp = domWindow ? domWindow->nowTimestamp().milliseconds() : 0; 7114 7114 7115 7115 auto metrics = m_player ? m_player->videoPlaybackQualityMetrics() : WTF::nullopt; -
trunk/Source/WebCore/page/DOMWindow.cpp
r260724 r260736 735 735 } 736 736 737 doubleDOMWindow::nowTimestamp() const738 { 739 return performance().now () / 1000.;737 ReducedResolutionSeconds DOMWindow::nowTimestamp() const 738 { 739 return performance().nowInReducedResolutionSeconds(); 740 740 } 741 741 -
trunk/Source/WebCore/page/DOMWindow.h
r260653 r260736 35 35 #include "ImageBitmap.h" 36 36 #include "PostMessageOptions.h" 37 #include "ReducedResolutionSeconds.h" 37 38 #include "ScrollToOptions.h" 38 39 #include "ScrollTypes.h" … … 350 351 351 352 Performance& performance() const; 352 WEBCORE_EXPORT doublenowTimestamp() const;353 WEBCORE_EXPORT ReducedResolutionSeconds nowTimestamp() const; 353 354 354 355 #if PLATFORM(IOS_FAMILY) -
trunk/Source/WebCore/page/IntersectionObserver.cpp
r259252 r260736 245 245 } 246 246 247 bool IntersectionObserver::createTimestamp(DOMHighResTimeStamp& timestamp) const247 Optional<ReducedResolutionSeconds> IntersectionObserver::nowTimestamp() const 248 248 { 249 249 if (!m_callback) 250 return false;250 return WTF::nullopt; 251 251 252 252 auto* context = m_callback->scriptExecutionContext(); 253 253 if (!context) 254 return false; 254 return WTF::nullopt; 255 255 256 ASSERT(context->isDocument()); 256 257 auto& document = downcast<Document>(*context); 257 if (auto* window = document.domWindow()) { 258 timestamp = window->performance().now(); 259 return true; 260 } 261 return false; 258 if (auto* window = document.domWindow()) 259 return window->nowTimestamp(); 260 261 return WTF::nullopt; 262 262 } 263 263 -
trunk/Source/WebCore/page/IntersectionObserver.h
r259252 r260736 95 95 void rootDestroyed(); 96 96 97 bool createTimestamp(DOMHighResTimeStamp&) const;97 Optional<ReducedResolutionSeconds> nowTimestamp() const; 98 98 99 99 void appendQueuedEntry(Ref<IntersectionObserverEntry>&&); -
trunk/Source/WebCore/page/Page.cpp
r260725 r260736 1359 1359 if (!document.domWindow()) 1360 1360 return; 1361 DOMHighResTimeStamptimestamp = document.domWindow()->nowTimestamp();1361 auto timestamp = document.domWindow()->nowTimestamp(); 1362 1362 if (auto* timelinesController = document.timelinesController()) 1363 1363 timelinesController->updateAnimationsAndSendEvents(timestamp); -
trunk/Source/WebCore/page/Performance.cpp
r248846 r260736 75 75 DOMHighResTimeStamp Performance::now() const 76 76 { 77 return nowInReducedResolutionSeconds().milliseconds(); 78 } 79 80 ReducedResolutionSeconds Performance::nowInReducedResolutionSeconds() const 81 { 77 82 Seconds now = MonotonicTime::now() - m_timeOrigin; 78 return reduceTimeResolution(now) .milliseconds();83 return reduceTimeResolution(now); 79 84 } 80 85 -
trunk/Source/WebCore/page/Performance.h
r243887 r260736 38 38 #include "ExceptionOr.h" 39 39 #include "GenericTaskQueue.h" 40 #include "ReducedResolutionSeconds.h" 40 41 #include <wtf/ListHashSet.h> 41 42 … … 59 60 60 61 DOMHighResTimeStamp now() const; 62 ReducedResolutionSeconds nowInReducedResolutionSeconds() const; 61 63 62 64 PerformanceNavigation* navigation(); -
trunk/Source/WebKit/ChangeLog
r260729 r260736 1 2020-04-26 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Rendering update steps should use Seconds for the timestamps 4 https://bugs.webkit.org/show_bug.cgi?id=210990 5 6 Reviewed by Daniel Bates. 7 8 * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp: 9 (WebKit::CompositingCoordinator::timestamp const): 10 1 11 2020-04-26 Peng Liu <peng.liu6@apple.com> 2 12 -
trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
r259284 r260736 181 181 if (!document) 182 182 return 0; 183 return document->domWindow() ? document->domWindow()->nowTimestamp() : document->monotonicTimestamp();183 return document->domWindow() ? document->domWindow()->nowTimestamp().seconds() : document->monotonicTimestamp(); 184 184 } 185 185
Note: See TracChangeset
for help on using the changeset viewer.