Skip to content

Commit e05d544

Browse files
committed
Remove monotonicallyIncreasingTime
https://bugs.webkit.org/show_bug.cgi?id=182911 Reviewed by Michael Catanzaro. Source/JavaScriptCore: * debugger/Debugger.cpp: (JSC::Debugger::willEvaluateScript): (JSC::Debugger::didEvaluateScript): * debugger/Debugger.h: * debugger/ScriptProfilingScope.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::breakpointActionProbe): * inspector/agents/InspectorHeapAgent.cpp: (Inspector::InspectorHeapAgent::snapshot): (Inspector::InspectorHeapAgent::didGarbageCollect): (Inspector::InspectorHeapAgent::dispatchGarbageCollectedEvent): * inspector/agents/InspectorHeapAgent.h: * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::startTracking): (Inspector::InspectorScriptProfilerAgent::willEvaluateScript): (Inspector::InspectorScriptProfilerAgent::didEvaluateScript): (Inspector::InspectorScriptProfilerAgent::addEvent): (Inspector::buildSamples): * inspector/agents/InspectorScriptProfilerAgent.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::takeSample): * runtime/SamplingProfiler.h: Source/WebCore: While generic code uses MonotonicTime, CAAnimation uses media time (CFTimeInterval). At this boundary, we convert MonotonicTime to media time, this is the same logic to the code before this patch. * Modules/gamepad/Gamepad.h: * Modules/mediasource/SourceBuffer.cpp: (WebCore::SourceBuffer::SourceBuffer): (WebCore::SourceBuffer::monitorBufferingRate): * Modules/mediasource/SourceBuffer.h: * Modules/speech/SpeechSynthesis.cpp: (WebCore::SpeechSynthesis::startSpeakingImmediately): (WebCore::SpeechSynthesis::fireEvent): * Modules/speech/SpeechSynthesisUtterance.h: * contentextensions/ContentExtensionCompiler.cpp: (WebCore::ContentExtensions::compileRuleList): * contentextensions/ContentExtensionParser.cpp: (WebCore::ContentExtensions::parseRuleList): * contentextensions/ContentExtensionsBackend.cpp: (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad const): * dom/Element.cpp: (WebCore::Element::setActive): * history/CachedPage.cpp: (WebCore::CachedPage::CachedPage): (WebCore::CachedPage::hasExpired const): * history/CachedPage.h: * html/HTMLMediaElement.cpp: (WebCore::HTMLMediaElement::startProgressEventTimer): (WebCore::HTMLMediaElement::progressEventTimerFired): (WebCore::HTMLMediaElement::refreshCachedTime const): (WebCore::HTMLMediaElement::invalidateCachedTime const): (WebCore::HTMLMediaElement::currentMediaTime const): (WebCore::HTMLMediaElement::startPlaybackProgressTimer): * html/HTMLMediaElement.h: * html/MediaElementSession.cpp: (WebCore::MediaElementSession::removeBehaviorRestriction): (WebCore::MediaElementSession::mostRecentUserInteractionTime const): (WebCore::MediaElementSession::resetPlaybackSessionState): * html/MediaElementSession.h: * html/parser/HTMLParserScheduler.cpp: (WebCore::PumpSession::PumpSession): (WebCore::HTMLParserScheduler::HTMLParserScheduler): * html/parser/HTMLParserScheduler.h: (WebCore::HTMLParserScheduler::checkForYield): * inspector/InspectorCanvas.cpp: (WebCore::InspectorCanvas::recordAction): (WebCore::InspectorCanvas::finalizeFrame): * inspector/InspectorCanvas.h: * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::startTracking): (WebCore::InspectorMemoryAgent::didHandleMemoryPressure): (WebCore::InspectorMemoryAgent::collectSample): * inspector/agents/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::timestamp): (WebCore::InspectorNetworkAgent::didFinishLoading): * inspector/agents/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::timestamp): * inspector/agents/WebHeapAgent.cpp: (WebCore::WebHeapAgent::dispatchGarbageCollectedEvent): * inspector/agents/WebHeapAgent.h: * loader/cache/CachedCSSStyleSheet.cpp: (WebCore::CachedCSSStyleSheet::restoreParsedStyleSheet): * loader/cache/CachedImage.cpp: (WebCore::CachedImage::didDraw): * loader/cache/CachedResource.cpp: (WebCore::CachedResource::didAccessDecodedData): * loader/cache/CachedResource.h: * loader/cache/MemoryCache.cpp: (WebCore::MemoryCache::pruneLiveResourcesToSize): * page/EventHandler.cpp: (WebCore::MaximumDurationTracker::MaximumDurationTracker): (WebCore::MaximumDurationTracker::~MaximumDurationTracker): * page/FocusController.cpp: (WebCore::FocusController::setFocusedElement): (WebCore::FocusController::timeSinceFocusWasSet const): * page/FocusController.h: * page/FrameView.cpp: (WebCore::FrameView::reset): (WebCore::FrameView::willPaintContents): (WebCore::FrameView::didPaintContents): * page/FrameView.h: * page/animation/AnimationBase.cpp: (WebCore::AnimationBase::freezeAtTime): (WebCore::AnimationBase::beginAnimationUpdateTime const): * page/animation/AnimationBase.h: (WebCore::AnimationBase::onAnimationStartResponse): * page/animation/CSSAnimationController.cpp: (WebCore::CSSAnimationControllerPrivate::beginAnimationUpdateTime): (WebCore::CSSAnimationControllerPrivate::receivedStartTimeResponse): (WebCore::CSSAnimationControllerPrivate::startTimeResponse): (WebCore::CSSAnimationController::notifyAnimationStarted): * page/animation/CSSAnimationController.h: * page/animation/CSSAnimationControllerPrivate.h: * page/mac/WheelEventDeltaFilterMac.h: * page/mac/WheelEventDeltaFilterMac.mm: (WebCore::WheelEventDeltaFilterMac::beginFilteringDeltas): (WebCore::WheelEventDeltaFilterMac::updateFromDelta): (WebCore::WheelEventDeltaFilterMac::endFilteringDeltas): * platform/ControlStates.h: (WebCore::ControlStates::timeSinceControlWasFocused const): (WebCore::ControlStates::setTimeSinceControlWasFocused): * platform/PlatformSpeechSynthesisUtterance.h: (WebCore::PlatformSpeechSynthesisUtterance::startTime const): (WebCore::PlatformSpeechSynthesisUtterance::setStartTime): * platform/gamepad/PlatformGamepad.h: (WebCore::PlatformGamepad::lastUpdateTime const): (WebCore::PlatformGamepad::connectTime const): (WebCore::PlatformGamepad::PlatformGamepad): * platform/gamepad/cocoa/GameControllerGamepad.mm: (WebCore::GameControllerGamepad::setupAsExtendedGamepad): (WebCore::GameControllerGamepad::setupAsGamepad): * platform/gamepad/mac/HIDGamepad.cpp: (WebCore::HIDGamepad::HIDGamepad): (WebCore::HIDGamepad::valueChanged): * platform/graphics/GraphicsLayer.cpp: (WebCore::GraphicsLayer::suspendAnimations): * platform/graphics/GraphicsLayer.h: * platform/graphics/GraphicsLayerClient.h: (WebCore::GraphicsLayerClient::notifyAnimationStarted): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: (WebCore::LayerClient::platformCALayerAnimationStarted): (WebCore::AVFWrapper::createImageForTimeInRect): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect): (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage): * platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::addAnimation): (WebCore::GraphicsLayerCA::pauseAnimation): (WebCore::GraphicsLayerCA::platformCALayerAnimationStarted): (WebCore::GraphicsLayerCA::setAnimationOnLayer): (WebCore::GraphicsLayerCA::pauseCAAnimationOnLayer): (WebCore::GraphicsLayerCA::createAnimationFromKeyframes): (WebCore::GraphicsLayerCA::appendToUncommittedAnimations): (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): * platform/graphics/ca/GraphicsLayerCA.h: (WebCore::GraphicsLayerCA::LayerPropertyAnimation::LayerPropertyAnimation): (WebCore::GraphicsLayerCA::AnimationProcessingAction::AnimationProcessingAction): * platform/graphics/ca/LayerPool.cpp: (WebCore::LayerPool::LayerPool): (WebCore::LayerPool::addLayer): (WebCore::LayerPool::decayedCapacity const): (WebCore::LayerPool::pruneTimerFired): * platform/graphics/ca/LayerPool.h: * platform/graphics/ca/PlatformCAAnimation.h: * platform/graphics/ca/PlatformCALayer.h: * platform/graphics/ca/PlatformCALayerClient.h: (WebCore::PlatformCALayerClient::platformCALayerAnimationStarted): * platform/graphics/ca/TileGrid.cpp: (WebCore::TileGrid::revalidateTiles): (WebCore::TileGrid::startedNewCohort): (WebCore::TileGrid::TileCohortInfo::timeUntilExpiration): (WebCore::TileGrid::cohortRemovalTimerFired): * platform/graphics/ca/TileGrid.h: (WebCore::TileGrid::TileCohortInfo::TileCohortInfo): * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h: * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: (mediaTimeToCurrentTime): (-[WebAnimationDelegate animationDidStart:]): (PlatformCALayerCocoa::animationStarted): * platform/graphics/ca/win/CACFLayerTreeHost.cpp: (WebCore::CACFLayerTreeHost::notifyAnimationsStarted): * platform/graphics/ca/win/PlatformCALayerWin.cpp: (PlatformCALayerWin::animationStarted): (PlatformCALayerWin::layerTreeAsString const): * platform/graphics/ca/win/PlatformCALayerWin.h: * platform/graphics/cocoa/WebCoreDecompressionSession.mm: (WebCore::WebCoreDecompressionSession::decodeSample): * platform/graphics/texmap/BitmapTexturePool.cpp: (WebCore::BitmapTexturePool::releaseUnusedTexturesTimerFired): * platform/graphics/texmap/BitmapTexturePool.h: (WebCore::BitmapTexturePool::Entry::markIsInUse): (WebCore::BitmapTexturePool::Entry::canBeReleased const): (): Deleted. * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: (WebCore::GraphicsLayerTextureMapper::GraphicsLayerTextureMapper): (WebCore::GraphicsLayerTextureMapper::addAnimation): (WebCore::GraphicsLayerTextureMapper::pauseAnimation): * platform/graphics/texmap/GraphicsLayerTextureMapper.h: * platform/graphics/texmap/TextureMapperAnimation.cpp: (WebCore::TextureMapperAnimation::TextureMapperAnimation): (WebCore::TextureMapperAnimation::apply): (WebCore::TextureMapperAnimation::pause): (WebCore::TextureMapperAnimation::resume): (WebCore::TextureMapperAnimation::computeTotalRunningTime): (WebCore::TextureMapperAnimations::pause): (WebCore::TextureMapperAnimations::suspend): * platform/graphics/texmap/TextureMapperAnimation.h: (WebCore::TextureMapperAnimation::startTime const): (WebCore::TextureMapperAnimation::pauseTime const): * platform/graphics/texmap/TextureMapperFPSCounter.cpp: (WebCore::TextureMapperFPSCounter::TextureMapperFPSCounter): (WebCore::TextureMapperFPSCounter::updateFPSAndDisplay): * platform/graphics/texmap/TextureMapperFPSCounter.h: * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.h: (WebCore::TextureMapperPlatformLayerBuffer::markUsed): (WebCore::TextureMapperPlatformLayerBuffer::lastUsedTime const): (): Deleted. * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp: (WebCore::TextureMapperPlatformLayerProxy::releaseUnusedBuffersTimerFired): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: (WebCore::CoordinatedGraphicsLayer::addAnimation): (WebCore::CoordinatedGraphicsLayer::pauseAnimation): (WebCore::CoordinatedGraphicsLayer::suspendAnimations): * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: * platform/mediastream/RealtimeMediaSource.h: * platform/mediastream/RealtimeOutgoingVideoSource.cpp: (WebCore::RealtimeOutgoingVideoSource::sendFrame): * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread): * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: (WebCore::DisplayCaptureSourceCocoa::startProducingData): (WebCore::DisplayCaptureSourceCocoa::stopProducingData): (WebCore::DisplayCaptureSourceCocoa::elapsedTime): * platform/mediastream/mac/DisplayCaptureSourceCocoa.h: * platform/mediastream/mac/MockRealtimeAudioSourceMac.h: * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm: (WebCore::MockRealtimeAudioSourceMac::render): * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer): (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable): * platform/mock/MockRealtimeAudioSource.cpp: (WebCore::MockRealtimeAudioSource::startProducingData): (WebCore::MockRealtimeAudioSource::stopProducingData): (WebCore::MockRealtimeAudioSource::elapsedTime): (WebCore::MockRealtimeAudioSource::tick): (WebCore::MockRealtimeAudioSource::delaySamples): * platform/mock/MockRealtimeAudioSource.h: (WebCore::MockRealtimeAudioSource::render): * platform/mock/MockRealtimeVideoSource.cpp: (WebCore::MockRealtimeVideoSource::startProducingData): (WebCore::MockRealtimeVideoSource::stopProducingData): (WebCore::MockRealtimeVideoSource::elapsedTime): (WebCore::MockRealtimeVideoSource::drawText): (WebCore::MockRealtimeVideoSource::delaySamples): (WebCore::MockRealtimeVideoSource::generateFrame): * platform/mock/MockRealtimeVideoSource.h: * platform/network/DNSResolveQueue.cpp: (WebCore::DNSResolveQueue::DNSResolveQueue): (WebCore::DNSResolveQueue::isUsingProxy): * platform/network/DNSResolveQueue.h: * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::suspendAnimations): * rendering/RenderBoxModelObject.h: * rendering/RenderElement.cpp: (WebCore::RenderElement::paintFocusRing): * rendering/RenderImage.cpp: (WebCore::RenderImage::paintAreaElementFocusRing): * rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::notifyAnimationStarted): (WebCore::RenderLayerBacking::suspendAnimations): * rendering/RenderLayerBacking.h: * rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::didPaintBacking): * rendering/RenderProgress.cpp: (WebCore::RenderProgress::RenderProgress): (WebCore::RenderProgress::animationProgress const): (WebCore::RenderProgress::updateAnimationState): * rendering/RenderProgress.h: * rendering/RenderTheme.cpp: (WebCore::RenderTheme::animationDurationForProgressBar const): * rendering/RenderTheme.h: * rendering/RenderThemeGtk.cpp: (WebCore::RenderThemeGtk::animationDurationForProgressBar const): * rendering/RenderThemeGtk.h: * rendering/RenderThemeIOS.h: * rendering/RenderThemeIOS.mm: (WebCore::RenderThemeIOS::animationDurationForProgressBar const): * rendering/RenderThemeMac.h: * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::animationDurationForProgressBar const): * svg/animation/SMILTimeContainer.cpp: (WebCore::SMILTimeContainer::SMILTimeContainer): (WebCore::SMILTimeContainer::elapsed const): (WebCore::SMILTimeContainer::isActive const): (WebCore::SMILTimeContainer::isPaused const): (WebCore::SMILTimeContainer::isStarted const): (WebCore::SMILTimeContainer::begin): (WebCore::SMILTimeContainer::pause): (WebCore::SMILTimeContainer::resume): (WebCore::SMILTimeContainer::setElapsed): (WebCore::SMILTimeContainer::timerFired): * svg/animation/SMILTimeContainer.h: * testing/Internals.cpp: (WebCore::Internals::delayMediaStreamTrackSamples): * testing/MockGamepad.cpp: (WebCore::MockGamepad::MockGamepad): (WebCore::MockGamepad::updateDetails): (WebCore::MockGamepad::setAxisValue): (WebCore::MockGamepad::setButtonValue): Source/WebCore/PAL: * pal/system/ClockGeneric.cpp: (PAL::ClockGeneric::currentTime const): (PAL::ClockGeneric::now const): * pal/system/ClockGeneric.h: Source/WebKit: * NetworkProcess/cache/CacheStorageEngineCache.cpp: (WebKit::CacheStorage::Cache::toRecordInformation): * Platform/IPC/ArgumentCoders.cpp: (IPC::ArgumentCoder<Seconds>::encode): (IPC::ArgumentCoder<Seconds>::decode): (IPC::ArgumentCoder<MonotonicTime>::encode): (IPC::ArgumentCoder<MonotonicTime>::decode): * Platform/IPC/ArgumentCoders.h: * Shared/Gamepad/GamepadData.cpp: (WebKit::GamepadData::GamepadData): * Shared/Gamepad/GamepadData.h: (WebKit::GamepadData::lastUpdateTime const): * Shared/WebCoreArgumentCoders.cpp: (IPC::ArgumentCoder<MonotonicTime>::encode): Deleted. (IPC::ArgumentCoder<MonotonicTime>::decode): Deleted. (IPC::ArgumentCoder<Seconds>::encode): Deleted. (IPC::ArgumentCoder<Seconds>::decode): Deleted. ArgumentCoders for MonotonicTime and Seconds are now used internally. Move them to Platform/IPC/ArgumentCoders.h. * Shared/WebCoreArgumentCoders.h: * UIProcess/API/glib/IconDatabase.cpp: (WebKit::IconDatabase::iconDatabaseSyncThread): * UIProcess/DrawingAreaProxyImpl.cpp: (WebKit::DrawingAreaProxyImpl::DrawingMonitor::start): (WebKit::DrawingAreaProxyImpl::DrawingMonitor::stop): (WebKit::DrawingAreaProxyImpl::DrawingMonitor::didDraw): * UIProcess/DrawingAreaProxyImpl.h: * UIProcess/Gamepad/UIGamepad.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::acceleratedAnimationDidStart): * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h: * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm: (WebKit::RemoteLayerTreeHost::animationDidStart): * WebProcess/WebPage/DrawingArea.h: (WebKit::DrawingArea::acceleratedAnimationDidStart): * WebProcess/WebPage/DrawingArea.messages.in: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.h: * WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm: (mediaTimeToCurrentTime): (-[WKAnimationDelegate animationDidStart:]): * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp: (WebKit::PlatformCALayerRemote::animationStarted): This argument `beginTime` is not CFTimeInverval actually. We add currentTimeToMediaTime conversion here to fix this issue. * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm: (WebKit::RemoteLayerTreeContext::animationDidStart): * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h: * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm: (WebKit::RemoteLayerTreeDrawingArea::acceleratedAnimationDidStart): * WebProcess/cocoa/WebProcessCocoa.mm: (WebKit::WebProcess::destroyRenderingResources): Source/WebKitLegacy/win: * FullscreenVideoController.cpp: (FullscreenVideoController::LayerClient::platformCALayerAnimationStarted): * Plugins/PluginMessageThrottlerWin.cpp: (WebCore::PluginMessageThrottlerWin::PluginMessageThrottlerWin): (WebCore::PluginMessageThrottlerWin::appendMessage): * Plugins/PluginMessageThrottlerWin.h: * WebView.cpp: (WebView::notifyAnimationStarted): * WebView.h: Source/WTF: This patch drops monotonicallyIncreasingTime and monotonicallyIncreasingTimeMS. We have MonotonicTime API instead. This offers strongly typed MonotonicTime, Seconds etc. This reduces the chance of bugs mixing doubles which represent milliseconds and seconds. Large part of this patch is mechanical one: replacing monotonicallyIncreasingTime with MonotonicTime, using MonotonicTime and Seconds instead of raw doubles. But this patch actually finds some bugs (but it is a bit difficult to show it as a test). One is mixing media time (CACurrentMediaTime()) and MonotonicTime. Basically they are super close because both uses mach_absolute_time(). But they would be slightly different. So we should not mix them. The second bug is GraphicsLayer::suspendAnimations(double). While CA ports (Apple, AppleWin, iOS etc.) use this double as MonotonicTime, GTK and WPE use this double as Seconds (timeOffset). This patch fixes it and now the signature becomes GraphicsLayer::suspendAnimations(MonotonicTime). In this patch, we still uses bunch of double for Seconds. But fixing them at this patch increases the size of this larger and larger. So some of them remains double. This should be fixed in subsequent patches. * benchmarks/ConditionSpeedTest.cpp: * benchmarks/LockSpeedTest.cpp: * wtf/CurrentTime.cpp: (WTF::MonotonicTime::now): (WTF::monotonicallyIncreasingTime): Deleted. * wtf/CurrentTime.h: (WTF::monotonicallyIncreasingTimeMS): Deleted. * wtf/MemoryPressureHandler.h: * wtf/MonotonicTime.cpp: (WTF::MonotonicTime::now): Deleted. * wtf/MonotonicTime.h: * wtf/ParkingLot.cpp: * wtf/Seconds.h: (WTF::Seconds::nan): * wtf/Stopwatch.h: (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): (WTF::Stopwatch::elapsedTimeSince): * wtf/cocoa/MemoryPressureHandlerCocoa.mm: (WTF::MemoryPressureHandler::holdOff): (WTF::MemoryPressureHandler::respondToMemoryPressure): * wtf/linux/MemoryPressureHandlerLinux.cpp: (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller): (WTF::MemoryPressureHandler::holdOff): (WTF::MemoryPressureHandler::respondToMemoryPressure): * wtf/win/MemoryPressureHandlerWin.cpp: (WTF::MemoryPressureHandler::holdOff): Canonical link: https://commits.webkit.org/198957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229174 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b6a6ea0 commit e05d544

177 files changed

Lines changed: 1069 additions & 614 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
2018-03-01 Yusuke Suzuki <utatane.tea@gmail.com>
2+
3+
Remove monotonicallyIncreasingTime
4+
https://bugs.webkit.org/show_bug.cgi?id=182911
5+
6+
Reviewed by Michael Catanzaro.
7+
8+
* debugger/Debugger.cpp:
9+
(JSC::Debugger::willEvaluateScript):
10+
(JSC::Debugger::didEvaluateScript):
11+
* debugger/Debugger.h:
12+
* debugger/ScriptProfilingScope.h:
13+
* inspector/agents/InspectorDebuggerAgent.cpp:
14+
(Inspector::InspectorDebuggerAgent::breakpointActionProbe):
15+
* inspector/agents/InspectorHeapAgent.cpp:
16+
(Inspector::InspectorHeapAgent::snapshot):
17+
(Inspector::InspectorHeapAgent::didGarbageCollect):
18+
(Inspector::InspectorHeapAgent::dispatchGarbageCollectedEvent):
19+
* inspector/agents/InspectorHeapAgent.h:
20+
* inspector/agents/InspectorScriptProfilerAgent.cpp:
21+
(Inspector::InspectorScriptProfilerAgent::startTracking):
22+
(Inspector::InspectorScriptProfilerAgent::willEvaluateScript):
23+
(Inspector::InspectorScriptProfilerAgent::didEvaluateScript):
24+
(Inspector::InspectorScriptProfilerAgent::addEvent):
25+
(Inspector::buildSamples):
26+
* inspector/agents/InspectorScriptProfilerAgent.h:
27+
* runtime/SamplingProfiler.cpp:
28+
(JSC::SamplingProfiler::takeSample):
29+
* runtime/SamplingProfiler.h:
30+
131
2018-03-01 Yusuke Suzuki <utatane.tea@gmail.com>
232

333
ASSERTION FAILED: matchContextualKeyword(m_vm->propertyNames->async)

‎Source/JavaScriptCore/debugger/Debugger.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,12 +247,12 @@ void Debugger::setProfilingClient(ProfilingClient* client)
247247
m_profilingClient = client;
248248
}
249249

250-
double Debugger::willEvaluateScript()
250+
Seconds Debugger::willEvaluateScript()
251251
{
252252
return m_profilingClient->willEvaluateScript();
253253
}
254254

255-
void Debugger::didEvaluateScript(double startTime, ProfilingReason reason)
255+
void Debugger::didEvaluateScript(Seconds startTime, ProfilingReason reason)
256256
{
257257
m_profilingClient->didEvaluateScript(startTime, reason);
258258
}

‎Source/JavaScriptCore/debugger/Debugger.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ class JS_EXPORT_PRIVATE Debugger {
140140
public:
141141
virtual ~ProfilingClient();
142142
virtual bool isAlreadyProfiling() const = 0;
143-
virtual double willEvaluateScript() = 0;
144-
virtual void didEvaluateScript(double startTime, ProfilingReason) = 0;
143+
virtual Seconds willEvaluateScript() = 0;
144+
virtual void didEvaluateScript(Seconds startTime, ProfilingReason) = 0;
145145
};
146146

147147
void setProfilingClient(ProfilingClient*);
148148
bool hasProfilingClient() const { return m_profilingClient != nullptr; }
149149
bool isAlreadyProfiling() const { return m_profilingClient && m_profilingClient->isAlreadyProfiling(); }
150-
double willEvaluateScript();
151-
void didEvaluateScript(double startTime, ProfilingReason);
150+
Seconds willEvaluateScript();
151+
void didEvaluateScript(Seconds startTime, ProfilingReason);
152152

153153
protected:
154154
virtual void handleBreakpointHit(JSGlobalObject*, const Breakpoint&) { }

‎Source/JavaScriptCore/debugger/ScriptProfilingScope.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ScriptProfilingScope {
8383
}
8484

8585
JSGlobalObject* m_globalObject { nullptr };
86-
std::optional<double> m_startTime;
86+
std::optional<Seconds> m_startTime;
8787
ProfilingReason m_reason;
8888
};
8989

‎Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ void InspectorDebuggerAgent::breakpointActionProbe(JSC::ExecState& scriptState,
10411041
.setProbeId(action.identifier)
10421042
.setBatchId(batchId)
10431043
.setSampleId(sampleId)
1044-
.setTimestamp(m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->elapsedTime())
1044+
.setTimestamp(m_injectedScriptManager.inspectorEnvironment().executionStopwatch()->elapsedTime().seconds())
10451045
.setPayload(WTFMove(payload))
10461046
.release();
10471047
m_frontendDispatcher->didSampleProbe(WTFMove(result));

‎Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void InspectorHeapAgent::snapshot(ErrorString&, double* timestamp, String* snaps
103103
HeapSnapshotBuilder snapshotBuilder(vm.ensureHeapProfiler());
104104
snapshotBuilder.buildSnapshot();
105105

106-
*timestamp = m_environment.executionStopwatch()->elapsedTime();
106+
*timestamp = m_environment.executionStopwatch()->elapsedTime().seconds();
107107
*snapshotData = snapshotBuilder.json([&] (const HeapSnapshotNode& node) {
108108
if (Structure* structure = node.cell->structure(vm)) {
109109
if (JSGlobalObject* globalObject = structure->globalObject()) {
@@ -273,7 +273,7 @@ void InspectorHeapAgent::willGarbageCollect()
273273
void InspectorHeapAgent::didGarbageCollect(CollectionScope scope)
274274
{
275275
if (!m_enabled) {
276-
m_gcStartTime = NAN;
276+
m_gcStartTime = Seconds::nan();
277277
return;
278278
}
279279

@@ -284,10 +284,10 @@ void InspectorHeapAgent::didGarbageCollect(CollectionScope scope)
284284

285285
// FIXME: Include number of bytes freed by collection.
286286

287-
double endTime = m_environment.executionStopwatch()->elapsedTime();
287+
Seconds endTime = m_environment.executionStopwatch()->elapsedTime();
288288
dispatchGarbageCollectedEvent(protocolTypeForHeapOperation(scope), m_gcStartTime, endTime);
289289

290-
m_gcStartTime = NAN;
290+
m_gcStartTime = Seconds::nan();
291291
}
292292

293293
void InspectorHeapAgent::clearHeapSnapshots()
@@ -301,12 +301,12 @@ void InspectorHeapAgent::clearHeapSnapshots()
301301
}
302302
}
303303

304-
void InspectorHeapAgent::dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime)
304+
void InspectorHeapAgent::dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type type, Seconds startTime, Seconds endTime)
305305
{
306306
auto protocolObject = Protocol::Heap::GarbageCollection::create()
307307
.setType(type)
308-
.setStartTime(startTime)
309-
.setEndTime(endTime)
308+
.setStartTime(startTime.seconds())
309+
.setEndTime(endTime.seconds())
310310
.release();
311311

312312
m_frontendDispatcher->garbageCollected(WTFMove(protocolObject));

‎Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "InspectorFrontendDispatchers.h"
3232
#include <wtf/Forward.h>
3333
#include <wtf/Noncopyable.h>
34+
#include <wtf/Seconds.h>
3435

3536
namespace JSC {
3637
struct HeapSnapshotNode;
@@ -68,7 +69,7 @@ class JS_EXPORT_PRIVATE InspectorHeapAgent : public InspectorAgentBase, public H
6869
protected:
6970
void clearHeapSnapshots();
7071

71-
virtual void dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type, double startTime, double endTime);
72+
virtual void dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type, Seconds startTime, Seconds endTime);
7273

7374
private:
7475
std::optional<JSC::HeapSnapshotNode> nodeForHeapObjectIdentifier(ErrorString&, unsigned heapObjectIdentifier);
@@ -80,7 +81,7 @@ class JS_EXPORT_PRIVATE InspectorHeapAgent : public InspectorAgentBase, public H
8081

8182
bool m_enabled { false };
8283
bool m_tracking { false };
83-
double m_gcStartTime { NAN };
84+
Seconds m_gcStartTime { Seconds::nan() };
8485
};
8586

8687
} // namespace Inspector

‎Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* inclu
9090

9191
m_environment.scriptDebugServer().setProfilingClient(this);
9292

93-
m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime());
93+
m_frontendDispatcher->trackingStart(m_environment.executionStopwatch()->elapsedTime().seconds());
9494
}
9595

9696
void InspectorScriptProfilerAgent::stopTracking(ErrorString&)
@@ -111,7 +111,7 @@ bool InspectorScriptProfilerAgent::isAlreadyProfiling() const
111111
return m_activeEvaluateScript;
112112
}
113113

114-
double InspectorScriptProfilerAgent::willEvaluateScript()
114+
Seconds InspectorScriptProfilerAgent::willEvaluateScript()
115115
{
116116
m_activeEvaluateScript = true;
117117

@@ -126,11 +126,11 @@ double InspectorScriptProfilerAgent::willEvaluateScript()
126126
return m_environment.executionStopwatch()->elapsedTime();
127127
}
128128

129-
void InspectorScriptProfilerAgent::didEvaluateScript(double startTime, ProfilingReason reason)
129+
void InspectorScriptProfilerAgent::didEvaluateScript(Seconds startTime, ProfilingReason reason)
130130
{
131131
m_activeEvaluateScript = false;
132132

133-
double endTime = m_environment.executionStopwatch()->elapsedTime();
133+
Seconds endTime = m_environment.executionStopwatch()->elapsedTime();
134134

135135
addEvent(startTime, endTime, reason);
136136
}
@@ -150,13 +150,13 @@ static Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)
150150
return Protocol::ScriptProfiler::EventType::Other;
151151
}
152152

153-
void InspectorScriptProfilerAgent::addEvent(double startTime, double endTime, ProfilingReason reason)
153+
void InspectorScriptProfilerAgent::addEvent(Seconds startTime, Seconds endTime, ProfilingReason reason)
154154
{
155155
ASSERT(endTime >= startTime);
156156

157157
auto event = Protocol::ScriptProfiler::Event::create()
158-
.setStartTime(startTime)
159-
.setEndTime(endTime)
158+
.setStartTime(startTime.seconds())
159+
.setEndTime(endTime.seconds())
160160
.setType(toProtocol(reason))
161161
.release();
162162

@@ -189,7 +189,7 @@ static Ref<Protocol::ScriptProfiler::Samples> buildSamples(VM& vm, Vector<Sampli
189189
frames->addItem(WTFMove(frameObject));
190190
}
191191
Ref<Protocol::ScriptProfiler::StackTrace> inspectorStackTrace = Protocol::ScriptProfiler::StackTrace::create()
192-
.setTimestamp(stackTrace.timestamp)
192+
.setTimestamp(stackTrace.timestamp.seconds())
193193
.setStackFrames(WTFMove(frames))
194194
.release();
195195
stackTraces->addItem(WTFMove(inspectorStackTrace));

‎Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ class JS_EXPORT_PRIVATE InspectorScriptProfilerAgent final : public InspectorAge
5858

5959
// Debugger::ProfilingClient
6060
bool isAlreadyProfiling() const override;
61-
double willEvaluateScript() override;
62-
void didEvaluateScript(double, JSC::ProfilingReason) override;
61+
Seconds willEvaluateScript() override;
62+
void didEvaluateScript(Seconds, JSC::ProfilingReason) override;
6363

6464
private:
65-
void addEvent(double startTime, double endTime, JSC::ProfilingReason);
65+
void addEvent(Seconds startTime, Seconds endTime, JSC::ProfilingReason);
6666
void trackingComplete();
6767
void stopSamplingWhenDisconnecting();
6868

‎Source/JavaScriptCore/runtime/SamplingProfiler.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ void SamplingProfiler::takeSample(const AbstractLocker&, Seconds& stackTraceProc
336336
{
337337
ASSERT(m_lock.isLocked());
338338
if (m_vm.entryScope) {
339-
double nowTime = m_stopwatch->elapsedTime();
339+
Seconds nowTime = m_stopwatch->elapsedTime();
340340

341341
auto machineThreadsLocker = holdLock(m_vm.heap.machineThreads().getLock());
342342
LockHolder codeBlockSetLocker(m_vm.heap.codeBlockSet().getLock());

0 commit comments

Comments
 (0)