haikuwebkit/Source/WTF/wtf/Stopwatch.h

96 lines
2.8 KiB
C
Raw Permalink Normal View History

Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
/*
* Copyright (C) 2014 University of Washington. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds https://bugs.webkit.org/show_bug.cgi?id=167768 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-02-03 Reviewed by Geoffrey Garen. Source/WebCore: The public APIs still return double (DOMHighResTimeStamp), which is milliseconds since a time origin: https://w3c.github.io/hr-time/#dom-domhighrestimestamp * loader/LoadTiming.cpp: (WebCore::LoadTiming::secondsSinceStartTime): (WebCore::LoadTiming::monotonicTimeToPseudoWallTime): (WebCore::LoadTiming::markStartTime): (WebCore::LoadTiming::addRedirect): (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime): Deleted. * loader/LoadTiming.h: (WebCore::LoadTiming::markUnloadEventStart): (WebCore::LoadTiming::markUnloadEventEnd): (WebCore::LoadTiming::markRedirectStart): (WebCore::LoadTiming::markRedirectEnd): (WebCore::LoadTiming::markFetchStart): (WebCore::LoadTiming::setResponseEnd): (WebCore::LoadTiming::markLoadEventStart): (WebCore::LoadTiming::markLoadEventEnd): (WebCore::LoadTiming::startTime): (WebCore::LoadTiming::unloadEventStart): (WebCore::LoadTiming::unloadEventEnd): (WebCore::LoadTiming::redirectStart): (WebCore::LoadTiming::redirectEnd): (WebCore::LoadTiming::fetchStart): (WebCore::LoadTiming::responseEnd): (WebCore::LoadTiming::loadEventStart): (WebCore::LoadTiming::loadEventEnd): (WebCore::LoadTiming::redirectCount): (WebCore::LoadTiming::referenceMonotonicTime): (WebCore::LoadTiming::referenceWallTime): Use MonotonicTime and WallTime for timestamps and references. * dom/Document.cpp: (WebCore::Document::setReadyState): (WebCore::Document::finishedParsing): (WebCore::Document::monotonicTimestamp): * dom/DocumentTiming.h: (WebCore::DocumentTiming::DocumentTiming): Deleted. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceScriptedAnimations): * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::didFinishLoading): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::finishedLoading): (WebCore::DocumentLoader::dataReceived): * loader/DocumentLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): * page/DOMWindow.cpp: (WebCore::DOMWindow::performance): Use new types instead of raw doubles. * page/Performance.cpp: (WebCore::Performance::Performance): (WebCore::Performance::now): (WebCore::Performance::reduceTimeResolution): (WebCore::Performance::addResourceTiming): * page/Performance.h: Do time arithmatic with WTF::Time classes. This clarifies that we reduce our timestamps to 100us resolution instead of the maximum 5us allowed by the spec. * page/PerformanceResourceTiming.cpp: (WebCore::monotonicTimeToDOMHighResTimeStamp): (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp): * page/PerformanceResourceTiming.h: * page/PerformanceTiming.cpp: (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart): (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds): (WebCore::toIntegerMilliseconds): Deleted. * page/PerformanceTiming.h: Do time arithmatic with WTF::Time classes. * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::create): (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope): * workers/DedicatedWorkerGlobalScope.h: * workers/DedicatedWorkerThread.cpp: (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): * workers/DedicatedWorkerThread.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerThread.cpp: (WebCore::WorkerThreadStartupData::WorkerThreadStartupData): (WebCore::WorkerThread::WorkerThread): * workers/WorkerThread.h: Pass time origin as MonotonicTime. * workers/Worker.cpp: (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: Rename creation timestamp member. This matches Document's m_documentCreationTime. Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTimeSince): (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Deleted. Canonical link: https://commits.webkit.org/184868@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-04 03:23:53 +00:00
#pragma once
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
#include <cmath>
Performance Timing: Convert WTF::MonotonicTime and WTF::Seconds https://bugs.webkit.org/show_bug.cgi?id=167768 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-02-03 Reviewed by Geoffrey Garen. Source/WebCore: The public APIs still return double (DOMHighResTimeStamp), which is milliseconds since a time origin: https://w3c.github.io/hr-time/#dom-domhighrestimestamp * loader/LoadTiming.cpp: (WebCore::LoadTiming::secondsSinceStartTime): (WebCore::LoadTiming::monotonicTimeToPseudoWallTime): (WebCore::LoadTiming::markStartTime): (WebCore::LoadTiming::addRedirect): (WebCore::LoadTiming::monotonicTimeToZeroBasedDocumentTime): Deleted. * loader/LoadTiming.h: (WebCore::LoadTiming::markUnloadEventStart): (WebCore::LoadTiming::markUnloadEventEnd): (WebCore::LoadTiming::markRedirectStart): (WebCore::LoadTiming::markRedirectEnd): (WebCore::LoadTiming::markFetchStart): (WebCore::LoadTiming::setResponseEnd): (WebCore::LoadTiming::markLoadEventStart): (WebCore::LoadTiming::markLoadEventEnd): (WebCore::LoadTiming::startTime): (WebCore::LoadTiming::unloadEventStart): (WebCore::LoadTiming::unloadEventEnd): (WebCore::LoadTiming::redirectStart): (WebCore::LoadTiming::redirectEnd): (WebCore::LoadTiming::fetchStart): (WebCore::LoadTiming::responseEnd): (WebCore::LoadTiming::loadEventStart): (WebCore::LoadTiming::loadEventEnd): (WebCore::LoadTiming::redirectCount): (WebCore::LoadTiming::referenceMonotonicTime): (WebCore::LoadTiming::referenceWallTime): Use MonotonicTime and WallTime for timestamps and references. * dom/Document.cpp: (WebCore::Document::setReadyState): (WebCore::Document::finishedParsing): (WebCore::Document::monotonicTimestamp): * dom/DocumentTiming.h: (WebCore::DocumentTiming::DocumentTiming): Deleted. * dom/ScriptedAnimationController.cpp: (WebCore::ScriptedAnimationController::serviceScriptedAnimations): * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::didFinishLoading): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::finishedLoading): (WebCore::DocumentLoader::dataReceived): * loader/DocumentLoader.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): * loader/cache/CachedResourceLoader.cpp: (WebCore::CachedResourceLoader::requestResource): * page/DOMWindow.cpp: (WebCore::DOMWindow::performance): Use new types instead of raw doubles. * page/Performance.cpp: (WebCore::Performance::Performance): (WebCore::Performance::now): (WebCore::Performance::reduceTimeResolution): (WebCore::Performance::addResourceTiming): * page/Performance.h: Do time arithmatic with WTF::Time classes. This clarifies that we reduce our timestamps to 100us resolution instead of the maximum 5us allowed by the spec. * page/PerformanceResourceTiming.cpp: (WebCore::monotonicTimeToDOMHighResTimeStamp): (WebCore::PerformanceResourceTiming::PerformanceResourceTiming): (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp): * page/PerformanceResourceTiming.h: * page/PerformanceTiming.cpp: (WebCore::PerformanceTiming::resourceLoadTimeRelativeToFetchStart): (WebCore::PerformanceTiming::monotonicTimeToIntegerMilliseconds): (WebCore::toIntegerMilliseconds): Deleted. * page/PerformanceTiming.h: Do time arithmatic with WTF::Time classes. * workers/DedicatedWorkerGlobalScope.cpp: (WebCore::DedicatedWorkerGlobalScope::create): (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope): * workers/DedicatedWorkerGlobalScope.h: * workers/DedicatedWorkerThread.cpp: (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): * workers/DedicatedWorkerThread.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerThread.cpp: (WebCore::WorkerThreadStartupData::WorkerThreadStartupData): (WebCore::WorkerThread::WorkerThread): * workers/WorkerThread.h: Pass time origin as MonotonicTime. * workers/Worker.cpp: (WebCore::Worker::create): (WebCore::Worker::notifyFinished): * workers/Worker.h: Rename creation timestamp member. This matches Document's m_documentCreationTime. Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTimeSince): (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Deleted. Canonical link: https://commits.webkit.org/184868@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211665 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-04 03:23:53 +00:00
#include <wtf/MonotonicTime.h>
#include <wtf/Ref.h>
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
#include <wtf/RefCounted.h>
namespace WTF {
class Stopwatch : public RefCounted<Stopwatch> {
public:
Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects https://bugs.webkit.org/show_bug.cgi?id=140053 Patch by Brian J. Burg <burg@cs.washington.edu> on 2015-01-07 Reviewed by Andreas Kling. Source/JavaScriptCore: This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code related to Web Inspector. It also converts many uses of RefPtr to Ref where references are always non-null. These two refactorings have been combined since they tend to require similar changes to the code. Creation methods for subclasses of InspectorValue now return a Ref, and callsites have been updated to take a Ref instead of RefPtr. Builders for typed protocol objects now return a Ref. Since there is no implicit call to operator&, callsites now must explicitly call .release() to convert a builder object into the corresponding protocol object once required fields are set. Update callsites and use auto to eliminate repetition of longwinded protocol types. Tests for inspector protocol and replay inputs have been rebaselined. * bindings/ScriptValue.cpp: (Deprecated::jsToInspectorValue): (Deprecated::ScriptValue::toInspectorValue): * bindings/ScriptValue.h: * inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::addToFrontend): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::buildObjectForSearchMatch): (Inspector::ContentSearchUtilities::searchInTextByLines): * inspector/ContentSearchUtilities.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getFunctionDetails): (Inspector::InjectedScript::getProperties): (Inspector::InjectedScript::getInternalProperties): (Inspector::InjectedScript::wrapCallFrames): (Inspector::InjectedScript::wrapObject): (Inspector::InjectedScript::wrapTable): * inspector/InjectedScript.h: * inspector/InjectedScriptBase.cpp: (Inspector::InjectedScriptBase::makeEvalCall): Split the early exits. * inspector/InspectorBackendDispatcher.cpp: (Inspector::InspectorBackendDispatcher::CallbackBase::CallbackBase): (Inspector::InspectorBackendDispatcher::CallbackBase::sendIfActive): (Inspector::InspectorBackendDispatcher::create): (Inspector::InspectorBackendDispatcher::dispatch): (Inspector::InspectorBackendDispatcher::sendResponse): (Inspector::InspectorBackendDispatcher::reportProtocolError): (Inspector::getPropertyValue): Add a comment to clarify what this clever code does. (Inspector::InspectorBackendDispatcher::getInteger): (Inspector::InspectorBackendDispatcher::getDouble): (Inspector::InspectorBackendDispatcher::getString): (Inspector::InspectorBackendDispatcher::getBoolean): (Inspector::InspectorBackendDispatcher::getObject): (Inspector::InspectorBackendDispatcher::getArray): (Inspector::InspectorBackendDispatcher::getValue): * inspector/InspectorBackendDispatcher.h: Use a typed protocol object to collect protocol error strings. (Inspector::InspectorSupplementalBackendDispatcher::InspectorSupplementalBackendDispatcher): Convert the supplemental dispatcher's reference to Ref since it is never null. * inspector/InspectorEnvironment.h: * inspector/InspectorProtocolTypes.h: Get rid of ArrayItemHelper and StructItemTraits. Add more versions of addItem to handle pushing various types. (Inspector::Protocol::Array::openAccessors): (Inspector::Protocol::Array::addItem): (Inspector::Protocol::Array::create): (Inspector::Protocol::StructItemTraits::push): (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast): Assert argument. (Inspector::Protocol::StructItemTraits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<String>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<int>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<double>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<bool>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<InspectorValue>::Traits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<InspectorObject>::Traits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<InspectorArray>::Traits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<Protocol::Array<T>>::Traits::pushRefPtr): Deleted. * inspector/InspectorValues.cpp: Straighten out getArray and getObject to have the same call signature as other getters. Use Ref where possible. (Inspector::InspectorObjectBase::getBoolean): (Inspector::InspectorObjectBase::getString): (Inspector::InspectorObjectBase::getObject): (Inspector::InspectorObjectBase::getArray): (Inspector::InspectorObjectBase::getValue): (Inspector::InspectorObjectBase::writeJSON): (Inspector::InspectorArrayBase::get): (Inspector::InspectorObject::create): (Inspector::InspectorArray::create): (Inspector::InspectorValue::null): (Inspector::InspectorString::create): (Inspector::InspectorBasicValue::create): (Inspector::InspectorObjectBase::get): Deleted. * inspector/InspectorValues.h: (Inspector::InspectorObjectBase::setValue): (Inspector::InspectorObjectBase::setObject): (Inspector::InspectorObjectBase::setArray): (Inspector::InspectorArrayBase::pushValue): (Inspector::InspectorArrayBase::pushObject): (Inspector::InspectorArrayBase::pushArray): * inspector/JSGlobalObjectConsoleClient.cpp: (Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel): (Inspector::JSGlobalObjectConsoleClient::count): (Inspector::JSGlobalObjectConsoleClient::timeEnd): (Inspector::JSGlobalObjectConsoleClient::timeStamp): * inspector/JSGlobalObjectConsoleClient.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptCallFrame.cpp: (Inspector::ScriptCallFrame::buildInspectorObject): * inspector/ScriptCallFrame.h: * inspector/ScriptCallStack.cpp: (Inspector::ScriptCallStack::create): (Inspector::ScriptCallStack::buildInspectorArray): * inspector/ScriptCallStack.h: * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::enable): (Inspector::InspectorAgent::inspect): (Inspector::InspectorAgent::activateExtraDomain): * inspector/agents/InspectorAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::buildObjectForBreakpointCookie): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): (Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP): (Inspector::InspectorDebuggerAgent::currentCallFrames): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::breakProgram): * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::buildErrorRangeObject): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): (Inspector::InspectorRuntimeAgent::getBasicBlocks): * inspector/agents/InspectorRuntimeAgent.h: * inspector/scripts/codegen/cpp_generator.py: (CppGenerator.cpp_type_for_unchecked_formal_in_parameter): (CppGenerator.cpp_type_for_type_with_name): (CppGenerator.cpp_type_for_formal_async_parameter): (CppGenerator.should_use_references_for_type): (CppGenerator): * inspector/scripts/codegen/cpp_generator_templates.py: * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: (CppBackendDispatcherHeaderGenerator.generate_output): (CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command): * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: (CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain): (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: (CppFrontendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator.generate_output): (_generate_class_for_object_declaration): (_generate_unchecked_setter_for_member): (_generate_forward_declarations_for_binding_traits): * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: (ObjCConfigurationImplementationGenerator._generate_success_block_for_command): * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: (ObjCFrontendDispatcherImplementationGenerator._generate_event): (ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters): * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator.generate_output): * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/enum-values.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: * replay/EncodedValue.cpp: (JSC::EncodedValue::asObject): (JSC::EncodedValue::asArray): (JSC::EncodedValue::put<EncodedValue>): (JSC::EncodedValue::append<EncodedValue>): (JSC::EncodedValue::get<EncodedValue>): * replay/EncodedValue.h: * replay/scripts/CodeGeneratorReplayInputs.py: (Type.borrow_type): (Type.argument_type): (Generator.generate_member_move_expression): * runtime/ConsoleClient.cpp: (JSC::ConsoleClient::printConsoleMessageWithArguments): (JSC::ConsoleClient::internalMessageWithTypeAndLevel): (JSC::ConsoleClient::logWithLevel): (JSC::ConsoleClient::clear): (JSC::ConsoleClient::dir): (JSC::ConsoleClient::dirXML): (JSC::ConsoleClient::table): (JSC::ConsoleClient::trace): (JSC::ConsoleClient::assertCondition): (JSC::ConsoleClient::group): (JSC::ConsoleClient::groupCollapsed): (JSC::ConsoleClient::groupEnd): * runtime/ConsoleClient.h: * runtime/TypeSet.cpp: (JSC::TypeSet::allStructureRepresentations): (JSC::TypeSet::inspectorTypeSet): (JSC::StructureShape::inspectorRepresentation): * runtime/TypeSet.h: Source/WebCore: This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code related to Web Inspector. It also converts many uses of RefPtr to Ref where references are always non-null. These two refactorings have been combined since they tend to require similar changes to the code. No new tests, no behavior changed. * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::openDatabase): * dom/Document.cpp: (WebCore::Document::logExceptionToConsole): (WebCore::Document::addMessage): * dom/Document.h: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportException): * dom/ScriptExecutionContext.h: * html/parser/XSSAuditorDelegate.cpp: (WebCore::XSSAuditorDelegate::generateViolationReport): * inspector/CommandLineAPIHost.cpp: (WebCore::CommandLineAPIHost::inspectImpl): * inspector/CommandLineAPIHost.h: * inspector/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests): (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache): (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources): (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource): * inspector/InspectorApplicationCacheAgent.h: * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getMatchedStylesForNode): (WebCore::InspectorCSSAgent::getComputedStyleForNode): (WebCore::InspectorCSSAgent::setStyleText): (WebCore::InspectorCSSAgent::setPropertyText): (WebCore::InspectorCSSAgent::toggleProperty): (WebCore::InspectorCSSAgent::setRuleSelector): (WebCore::InspectorCSSAgent::getSupportedCSSProperties): (WebCore::InspectorCSSAgent::forcePseudoState): (WebCore::InspectorCSSAgent::getNamedFlowCollection): (WebCore::InspectorCSSAgent::detectOrigin): (WebCore::InspectorCSSAgent::buildObjectForRule): (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): (WebCore::InspectorCSSAgent::buildObjectForAttributesStyle): (WebCore::InspectorCSSAgent::buildArrayForRegions): (WebCore::InspectorCSSAgent::buildObjectForNamedFlow): * inspector/InspectorCSSAgent.h: * inspector/InspectorConsoleInstrumentation.h: (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::stopProfiling): * inspector/InspectorController.cpp: (WebCore::InspectorController::buildObjectForHighlightedNode): (WebCore::InspectorController::executionStopwatch): * inspector/InspectorController.h: * inspector/InspectorDOMAgent.cpp: (WebCore::parseColor): (WebCore::parseConfigColor): (WebCore::InspectorDOMAgent::pushNodePathToFrontend): (WebCore::InspectorDOMAgent::performSearch): (WebCore::InspectorDOMAgent::setInspectModeEnabled): (WebCore::InspectorDOMAgent::highlightRect): (WebCore::InspectorDOMAgent::highlightQuad): (WebCore::InspectorDOMAgent::innerHighlightQuad): (WebCore::InspectorDOMAgent::highlightNode): (WebCore::InspectorDOMAgent::highlightFrame): (WebCore::InspectorDOMAgent::buildObjectForNode): (WebCore::InspectorDOMAgent::buildArrayForElementAttributes): (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::processAccessibilityChildren): (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): (WebCore::InspectorDOMAgent::didCommitLoad): (WebCore::InspectorDOMAgent::didInsertDOMNode): (WebCore::InspectorDOMAgent::styleAttributeInvalidated): (WebCore::InspectorDOMAgent::resolveNode): * inspector/InspectorDOMAgent.h: * inspector/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): * inspector/InspectorDOMDebuggerAgent.h: * inspector/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::getDOMStorageItems): (WebCore::InspectorDOMStorageAgent::setDOMStorageItem): (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): (WebCore::InspectorDOMStorageAgent::storageId): (WebCore::InspectorDOMStorageAgent::findStorageArea): * inspector/InspectorDOMStorageAgent.h: * inspector/InspectorDatabaseAgent.cpp: Use Ref for all callbacks since they are not nullable. (WebCore::InspectorDatabaseAgent::executeSQL): * inspector/InspectorDatabaseAgent.h: * inspector/InspectorDatabaseInstrumentation.h: (WebCore::InspectorInstrumentation::didOpenDatabase): * inspector/InspectorDatabaseResource.cpp: (WebCore::InspectorDatabaseResource::create): (WebCore::InspectorDatabaseResource::InspectorDatabaseResource): (WebCore::InspectorDatabaseResource::bind): * inspector/InspectorDatabaseResource.h: (WebCore::InspectorDatabaseResource::setDatabase): * inspector/InspectorFrontendHost.h: (WebCore::InspectorFrontendHost::create): * inspector/InspectorIndexedDBAgent.cpp: Use Ref for all callbacks since they are not nullable. (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): (WebCore::InspectorIndexedDBAgent::requestDatabase): (WebCore::InspectorIndexedDBAgent::requestData): (WebCore::ClearObjectStoreListener::create): (WebCore::ClearObjectStoreListener::ClearObjectStoreListener): (WebCore::ClearObjectStore::create): (WebCore::ClearObjectStore::ClearObjectStore): (WebCore::InspectorIndexedDBAgent::clearObjectStore): * inspector/InspectorIndexedDBAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::willLoadXHRImpl): (WebCore::InspectorInstrumentation::addMessageToConsoleImpl): (WebCore::InspectorInstrumentation::consoleCountImpl): (WebCore::InspectorInstrumentation::stopConsoleTimingImpl): (WebCore::InspectorInstrumentation::consoleTimeStampImpl): (WebCore::InspectorInstrumentation::stopProfilingImpl): (WebCore::InspectorInstrumentation::didOpenDatabaseImpl): (WebCore::InspectorInstrumentation::sessionCreatedImpl): (WebCore::InspectorInstrumentation::sessionLoadedImpl): (WebCore::InspectorInstrumentation::sessionModifiedImpl): (WebCore::InspectorInstrumentation::segmentCreatedImpl): (WebCore::InspectorInstrumentation::segmentCompletedImpl): (WebCore::InspectorInstrumentation::segmentLoadedImpl): (WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl): Deleted. (WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl): Deleted. (WebCore::InspectorInstrumentation::startProfilingImpl): Deleted. (WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl): Deleted. (WebCore::InspectorInstrumentation::willEvaluateWorkerScript): Deleted. (WebCore::InspectorInstrumentation::captureStoppedImpl): Deleted. (WebCore::InspectorInstrumentation::playbackStartedImpl): Deleted. (WebCore::InspectorInstrumentation::playbackPausedImpl): Deleted. (WebCore::InspectorInstrumentation::playbackHitPositionImpl): Deleted. (WebCore::InspectorInstrumentation::playbackFinishedImpl): Deleted. (WebCore::InspectorInstrumentation::networkStateChangedImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::willLoadXHR): (WebCore::InspectorInstrumentation::sessionCreated): (WebCore::InspectorInstrumentation::sessionLoaded): (WebCore::InspectorInstrumentation::sessionModified): (WebCore::InspectorInstrumentation::segmentCreated): (WebCore::InspectorInstrumentation::segmentCompleted): (WebCore::InspectorInstrumentation::segmentLoaded): (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient): Deleted. (WebCore::InspectorInstrumentation::didSendWebSocketFrame): Deleted. * inspector/InspectorLayerTreeAgent.cpp: (WebCore::InspectorLayerTreeAgent::buildObjectForLayer): (WebCore::InspectorLayerTreeAgent::buildObjectForIntRect): (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer): * inspector/InspectorLayerTreeAgent.h: * inspector/InspectorOverlay.cpp: (WebCore::buildObjectForPoint): (WebCore::buildObjectForRect): (WebCore::buildArrayForQuad): (WebCore::buildObjectForHighlight): (WebCore::buildObjectForRegionHighlight): (WebCore::buildObjectForCSSRegionsHighlight): (WebCore::buildObjectForSize): (WebCore::buildObjectForCSSRegionContentClip): (WebCore::InspectorOverlay::drawPaintRects): (WebCore::buildObjectForRendererFragments): (WebCore::buildObjectForShapeOutside): (WebCore::buildObjectForElementInfo): (WebCore::InspectorOverlay::buildObjectForHighlightedNode): (WebCore::InspectorOverlay::reset): (WebCore::InspectorOverlay::evaluateInOverlay): * inspector/InspectorOverlay.h: * inspector/InspectorPageAgent.cpp: (WebCore::createXHRTextDecoder): (WebCore::buildObjectForCookie): (WebCore::buildArrayForCookies): (WebCore::buildObjectForSearchResult): (WebCore::InspectorPageAgent::buildObjectForFrame): (WebCore::InspectorPageAgent::buildObjectForFrameTree): * inspector/InspectorPageAgent.h: * inspector/InspectorReplayAgent.cpp: (WebCore::buildInspectorObjectForPosition): (WebCore::buildInspectorObjectForInput): (WebCore::buildInspectorObjectForSession): (WebCore::buildInspectorObjectForSegment): (WebCore::InspectorReplayAgent::replayToPosition): (WebCore::InspectorReplayAgent::getSessionData): (WebCore::InspectorReplayAgent::getSegmentData): * inspector/InspectorReplayAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::buildObjectForHeaders): (WebCore::buildObjectForTiming): (WebCore::buildObjectForResourceRequest): (WebCore::buildObjectForResourceResponse): (WebCore::buildObjectForCachedResource): (WebCore::InspectorResourceAgent::willLoadXHR): (WebCore::InspectorResourceAgent::buildInitiatorObject): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::setExtraHTTPHeaders): (WebCore::InspectorResourceAgent::loadResource): (WebCore::InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient): Deleted. (WebCore::InspectorResourceAgent::didScheduleStyleRecalculation): Deleted. (WebCore::InspectorResourceAgent::disable): Deleted. (WebCore::InspectorResourceAgent::setCacheDisabled): Deleted. * inspector/InspectorResourceAgent.h: * inspector/InspectorStyleSheet.cpp: (ParsedStyleSheet::ruleSourceDataAt): (WebCore::buildSourceRangeObject): (WebCore::buildMediaObject): (WebCore::asCSSRuleList): (WebCore::fillMediaListChain): (WebCore::InspectorStyle::create): (WebCore::InspectorStyle::InspectorStyle): (WebCore::InspectorStyle::buildObjectForStyle): (WebCore::InspectorStyle::buildArrayForComputedStyle): (WebCore::InspectorStyle::styleWithProperties): (WebCore::InspectorStyle::extractSourceData): (WebCore::InspectorStyleSheet::create): (WebCore::InspectorStyleSheet::InspectorStyleSheet): (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): (WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo): (WebCore::buildObjectForSelectorHelper): (WebCore::selectorsFromSource): (WebCore::InspectorStyleSheet::buildObjectForSelector): (WebCore::InspectorStyleSheet::buildObjectForSelectorList): (WebCore::InspectorStyleSheet::buildObjectForRule): (WebCore::InspectorStyleSheet::buildObjectForStyle): (WebCore::InspectorStyleSheet::toggleProperty): (WebCore::InspectorStyleSheet::inspectorStyleForId): (WebCore::InspectorStyleSheet::rememberInspectorStyle): (WebCore::InspectorStyleSheet::buildArrayForRuleList): (WebCore::InspectorStyleSheet::collectFlatRules): (WebCore::InspectorStyleSheetForInlineStyle::create): (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle): (WebCore::InspectorStyleSheetForInlineStyle::inspectorStyleForId): * inspector/InspectorStyleSheet.h: (WebCore::InspectorCSSId::InspectorCSSId): (WebCore::InspectorCSSId::asProtocolValue): * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::stopFromConsole): (WebCore::InspectorTimelineAgent::addRecordToTimeline): (WebCore::InspectorTimelineAgent::didCompleteRecordEntry): (WebCore::InspectorTimelineAgent::appendRecord): (WebCore::InspectorTimelineAgent::sendEvent): (WebCore::InspectorTimelineAgent::createRecordEntry): (WebCore::InspectorTimelineAgent::pushCurrentRecord): * inspector/InspectorTimelineAgent.h: * inspector/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::sendMessageToWorker): * inspector/InspectorWorkerAgent.h: * inspector/NetworkResourcesData.cpp: (WebCore::XHRReplayData::create): (WebCore::XHRReplayData::XHRReplayData): * inspector/NetworkResourcesData.h: (WebCore::NetworkResourcesData::ResourceData::decoder): (WebCore::NetworkResourcesData::ResourceData::setDecoder): (WebCore::NetworkResourcesData::ResourceData::buffer): (WebCore::NetworkResourcesData::ResourceData::setBuffer): * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): (WebCore::TimelineRecordFactory::createBackgroundRecord): (WebCore::TimelineRecordFactory::createGCEventData): (WebCore::TimelineRecordFactory::createFunctionCallData): (WebCore::TimelineRecordFactory::createConsoleProfileData): (WebCore::TimelineRecordFactory::createProbeSampleData): (WebCore::TimelineRecordFactory::createEventDispatchData): (WebCore::TimelineRecordFactory::createGenericTimerData): (WebCore::TimelineRecordFactory::createTimerInstallData): (WebCore::TimelineRecordFactory::createXHRReadyStateChangeData): (WebCore::TimelineRecordFactory::createXHRLoadData): (WebCore::TimelineRecordFactory::createEvaluateScriptData): (WebCore::TimelineRecordFactory::createTimeStampData): (WebCore::TimelineRecordFactory::createScheduleResourceRequestData): (WebCore::TimelineRecordFactory::createResourceSendRequestData): (WebCore::TimelineRecordFactory::createResourceReceiveResponseData): (WebCore::TimelineRecordFactory::createResourceFinishData): (WebCore::TimelineRecordFactory::createReceiveResourceData): (WebCore::TimelineRecordFactory::createLayoutData): (WebCore::TimelineRecordFactory::createDecodeImageData): (WebCore::TimelineRecordFactory::createResizeImageData): (WebCore::TimelineRecordFactory::createMarkData): (WebCore::TimelineRecordFactory::createParseHTMLData): (WebCore::TimelineRecordFactory::createAnimationFrameData): (WebCore::createQuad): (WebCore::TimelineRecordFactory::createPaintData): (WebCore::buildInspectorObject): (WebCore::buildProfileInspectorObject): (WebCore::TimelineRecordFactory::appendProfile): * inspector/TimelineRecordFactory.h: (WebCore::TimelineRecordFactory::createWebSocketCreateData): (WebCore::TimelineRecordFactory::createGenericWebSocketData): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::executionStopwatch): * inspector/WorkerInspectorController.h: * page/PageConsoleClient.cpp: (WebCore::PageConsoleClient::addMessage): (WebCore::PageConsoleClient::messageWithTypeAndLevel): (WebCore::PageConsoleClient::count): (WebCore::PageConsoleClient::profileEnd): (WebCore::PageConsoleClient::timeEnd): (WebCore::PageConsoleClient::timeStamp): * page/PageConsoleClient.h: * replay/ReplayController.cpp: (WebCore::ReplayController::switchSession): (WebCore::ReplayController::createSegment): (WebCore::ReplayController::completeSegment): (WebCore::ReplayController::loadSegmentAtIndex): * replay/ReplayInputCreationMethods.cpp: (WebCore::InitialNavigation::createFromPage): * workers/SharedWorkerGlobalScope.cpp: (WebCore::SharedWorkerGlobalScope::logExceptionToConsole): * workers/SharedWorkerGlobalScope.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::logExceptionToConsole): (WebCore::WorkerGlobalScope::addMessage): (WebCore::WorkerGlobalScope::addMessageToWorkerConsole): * workers/WorkerGlobalScope.h: Source/WebKit: * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: update symbol. Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::create): Return a Ref. Canonical link: https://commits.webkit.org/158174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-07 23:29:03 +00:00
static Ref<Stopwatch> create()
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
{
Web Inspector: purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects https://bugs.webkit.org/show_bug.cgi?id=140053 Patch by Brian J. Burg <burg@cs.washington.edu> on 2015-01-07 Reviewed by Andreas Kling. Source/JavaScriptCore: This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code related to Web Inspector. It also converts many uses of RefPtr to Ref where references are always non-null. These two refactorings have been combined since they tend to require similar changes to the code. Creation methods for subclasses of InspectorValue now return a Ref, and callsites have been updated to take a Ref instead of RefPtr. Builders for typed protocol objects now return a Ref. Since there is no implicit call to operator&, callsites now must explicitly call .release() to convert a builder object into the corresponding protocol object once required fields are set. Update callsites and use auto to eliminate repetition of longwinded protocol types. Tests for inspector protocol and replay inputs have been rebaselined. * bindings/ScriptValue.cpp: (Deprecated::jsToInspectorValue): (Deprecated::ScriptValue::toInspectorValue): * bindings/ScriptValue.h: * inspector/ConsoleMessage.cpp: (Inspector::ConsoleMessage::addToFrontend): * inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::buildObjectForSearchMatch): (Inspector::ContentSearchUtilities::searchInTextByLines): * inspector/ContentSearchUtilities.h: * inspector/InjectedScript.cpp: (Inspector::InjectedScript::getFunctionDetails): (Inspector::InjectedScript::getProperties): (Inspector::InjectedScript::getInternalProperties): (Inspector::InjectedScript::wrapCallFrames): (Inspector::InjectedScript::wrapObject): (Inspector::InjectedScript::wrapTable): * inspector/InjectedScript.h: * inspector/InjectedScriptBase.cpp: (Inspector::InjectedScriptBase::makeEvalCall): Split the early exits. * inspector/InspectorBackendDispatcher.cpp: (Inspector::InspectorBackendDispatcher::CallbackBase::CallbackBase): (Inspector::InspectorBackendDispatcher::CallbackBase::sendIfActive): (Inspector::InspectorBackendDispatcher::create): (Inspector::InspectorBackendDispatcher::dispatch): (Inspector::InspectorBackendDispatcher::sendResponse): (Inspector::InspectorBackendDispatcher::reportProtocolError): (Inspector::getPropertyValue): Add a comment to clarify what this clever code does. (Inspector::InspectorBackendDispatcher::getInteger): (Inspector::InspectorBackendDispatcher::getDouble): (Inspector::InspectorBackendDispatcher::getString): (Inspector::InspectorBackendDispatcher::getBoolean): (Inspector::InspectorBackendDispatcher::getObject): (Inspector::InspectorBackendDispatcher::getArray): (Inspector::InspectorBackendDispatcher::getValue): * inspector/InspectorBackendDispatcher.h: Use a typed protocol object to collect protocol error strings. (Inspector::InspectorSupplementalBackendDispatcher::InspectorSupplementalBackendDispatcher): Convert the supplemental dispatcher's reference to Ref since it is never null. * inspector/InspectorEnvironment.h: * inspector/InspectorProtocolTypes.h: Get rid of ArrayItemHelper and StructItemTraits. Add more versions of addItem to handle pushing various types. (Inspector::Protocol::Array::openAccessors): (Inspector::Protocol::Array::addItem): (Inspector::Protocol::Array::create): (Inspector::Protocol::StructItemTraits::push): (Inspector::Protocol::BindingTraits<Protocol::Array<T>>::runtimeCast): Assert argument. (Inspector::Protocol::StructItemTraits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<String>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<int>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<double>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<bool>::Traits::pushRaw): Deleted. (Inspector::Protocol::ArrayItemHelper<InspectorValue>::Traits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<InspectorObject>::Traits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<InspectorArray>::Traits::pushRefPtr): Deleted. (Inspector::Protocol::ArrayItemHelper<Protocol::Array<T>>::Traits::pushRefPtr): Deleted. * inspector/InspectorValues.cpp: Straighten out getArray and getObject to have the same call signature as other getters. Use Ref where possible. (Inspector::InspectorObjectBase::getBoolean): (Inspector::InspectorObjectBase::getString): (Inspector::InspectorObjectBase::getObject): (Inspector::InspectorObjectBase::getArray): (Inspector::InspectorObjectBase::getValue): (Inspector::InspectorObjectBase::writeJSON): (Inspector::InspectorArrayBase::get): (Inspector::InspectorObject::create): (Inspector::InspectorArray::create): (Inspector::InspectorValue::null): (Inspector::InspectorString::create): (Inspector::InspectorBasicValue::create): (Inspector::InspectorObjectBase::get): Deleted. * inspector/InspectorValues.h: (Inspector::InspectorObjectBase::setValue): (Inspector::InspectorObjectBase::setObject): (Inspector::InspectorObjectBase::setArray): (Inspector::InspectorArrayBase::pushValue): (Inspector::InspectorArrayBase::pushObject): (Inspector::InspectorArrayBase::pushArray): * inspector/JSGlobalObjectConsoleClient.cpp: (Inspector::JSGlobalObjectConsoleClient::messageWithTypeAndLevel): (Inspector::JSGlobalObjectConsoleClient::count): (Inspector::JSGlobalObjectConsoleClient::timeEnd): (Inspector::JSGlobalObjectConsoleClient::timeStamp): * inspector/JSGlobalObjectConsoleClient.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptCallFrame.cpp: (Inspector::ScriptCallFrame::buildInspectorObject): * inspector/ScriptCallFrame.h: * inspector/ScriptCallStack.cpp: (Inspector::ScriptCallStack::create): (Inspector::ScriptCallStack::buildInspectorArray): * inspector/ScriptCallStack.h: * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::enable): (Inspector::InspectorAgent::inspect): (Inspector::InspectorAgent::activateExtraDomain): * inspector/agents/InspectorAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::buildObjectForBreakpointCookie): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): (Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP): (Inspector::InspectorDebuggerAgent::currentCallFrames): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::breakProgram): * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::buildErrorRangeObject): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets): (Inspector::InspectorRuntimeAgent::getBasicBlocks): * inspector/agents/InspectorRuntimeAgent.h: * inspector/scripts/codegen/cpp_generator.py: (CppGenerator.cpp_type_for_unchecked_formal_in_parameter): (CppGenerator.cpp_type_for_type_with_name): (CppGenerator.cpp_type_for_formal_async_parameter): (CppGenerator.should_use_references_for_type): (CppGenerator): * inspector/scripts/codegen/cpp_generator_templates.py: * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: (CppBackendDispatcherHeaderGenerator.generate_output): (CppBackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command): * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: (CppBackendDispatcherImplementationGenerator._generate_small_dispatcher_switch_implementation_for_domain): (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: (CppFrontendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: (CppProtocolTypesHeaderGenerator.generate_output): (_generate_class_for_object_declaration): (_generate_unchecked_setter_for_member): (_generate_forward_declarations_for_binding_traits): * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: (ObjCConfigurationImplementationGenerator._generate_success_block_for_command): * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: (ObjCFrontendDispatcherImplementationGenerator._generate_event): (ObjCFrontendDispatcherImplementationGenerator._generate_event_out_parameters): * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: (ObjCProtocolTypesImplementationGenerator.generate_output): * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/enum-values.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: * replay/EncodedValue.cpp: (JSC::EncodedValue::asObject): (JSC::EncodedValue::asArray): (JSC::EncodedValue::put<EncodedValue>): (JSC::EncodedValue::append<EncodedValue>): (JSC::EncodedValue::get<EncodedValue>): * replay/EncodedValue.h: * replay/scripts/CodeGeneratorReplayInputs.py: (Type.borrow_type): (Type.argument_type): (Generator.generate_member_move_expression): * runtime/ConsoleClient.cpp: (JSC::ConsoleClient::printConsoleMessageWithArguments): (JSC::ConsoleClient::internalMessageWithTypeAndLevel): (JSC::ConsoleClient::logWithLevel): (JSC::ConsoleClient::clear): (JSC::ConsoleClient::dir): (JSC::ConsoleClient::dirXML): (JSC::ConsoleClient::table): (JSC::ConsoleClient::trace): (JSC::ConsoleClient::assertCondition): (JSC::ConsoleClient::group): (JSC::ConsoleClient::groupCollapsed): (JSC::ConsoleClient::groupEnd): * runtime/ConsoleClient.h: * runtime/TypeSet.cpp: (JSC::TypeSet::allStructureRepresentations): (JSC::TypeSet::inspectorTypeSet): (JSC::StructureShape::inspectorRepresentation): * runtime/TypeSet.h: Source/WebCore: This patch replaces uses of PassRefPtr with uses of RefPtr&& and WTF::move() in code related to Web Inspector. It also converts many uses of RefPtr to Ref where references are always non-null. These two refactorings have been combined since they tend to require similar changes to the code. No new tests, no behavior changed. * Modules/webdatabase/DatabaseManager.cpp: (WebCore::DatabaseManager::openDatabase): * dom/Document.cpp: (WebCore::Document::logExceptionToConsole): (WebCore::Document::addMessage): * dom/Document.h: * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::reportException): * dom/ScriptExecutionContext.h: * html/parser/XSSAuditorDelegate.cpp: (WebCore::XSSAuditorDelegate::generateViolationReport): * inspector/CommandLineAPIHost.cpp: (WebCore::CommandLineAPIHost::inspectImpl): * inspector/CommandLineAPIHost.h: * inspector/InspectorApplicationCacheAgent.cpp: (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests): (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCache): (WebCore::InspectorApplicationCacheAgent::buildArrayForApplicationCacheResources): (WebCore::InspectorApplicationCacheAgent::buildObjectForApplicationCacheResource): * inspector/InspectorApplicationCacheAgent.h: * inspector/InspectorCSSAgent.cpp: (WebCore::InspectorCSSAgent::getMatchedStylesForNode): (WebCore::InspectorCSSAgent::getComputedStyleForNode): (WebCore::InspectorCSSAgent::setStyleText): (WebCore::InspectorCSSAgent::setPropertyText): (WebCore::InspectorCSSAgent::toggleProperty): (WebCore::InspectorCSSAgent::setRuleSelector): (WebCore::InspectorCSSAgent::getSupportedCSSProperties): (WebCore::InspectorCSSAgent::forcePseudoState): (WebCore::InspectorCSSAgent::getNamedFlowCollection): (WebCore::InspectorCSSAgent::detectOrigin): (WebCore::InspectorCSSAgent::buildObjectForRule): (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList): (WebCore::InspectorCSSAgent::buildObjectForAttributesStyle): (WebCore::InspectorCSSAgent::buildArrayForRegions): (WebCore::InspectorCSSAgent::buildObjectForNamedFlow): * inspector/InspectorCSSAgent.h: * inspector/InspectorConsoleInstrumentation.h: (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::stopProfiling): * inspector/InspectorController.cpp: (WebCore::InspectorController::buildObjectForHighlightedNode): (WebCore::InspectorController::executionStopwatch): * inspector/InspectorController.h: * inspector/InspectorDOMAgent.cpp: (WebCore::parseColor): (WebCore::parseConfigColor): (WebCore::InspectorDOMAgent::pushNodePathToFrontend): (WebCore::InspectorDOMAgent::performSearch): (WebCore::InspectorDOMAgent::setInspectModeEnabled): (WebCore::InspectorDOMAgent::highlightRect): (WebCore::InspectorDOMAgent::highlightQuad): (WebCore::InspectorDOMAgent::innerHighlightQuad): (WebCore::InspectorDOMAgent::highlightNode): (WebCore::InspectorDOMAgent::highlightFrame): (WebCore::InspectorDOMAgent::buildObjectForNode): (WebCore::InspectorDOMAgent::buildArrayForElementAttributes): (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::processAccessibilityChildren): (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties): (WebCore::InspectorDOMAgent::didCommitLoad): (WebCore::InspectorDOMAgent::didInsertDOMNode): (WebCore::InspectorDOMAgent::styleAttributeInvalidated): (WebCore::InspectorDOMAgent::resolveNode): * inspector/InspectorDOMAgent.h: * inspector/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): (WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent): (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): * inspector/InspectorDOMDebuggerAgent.h: * inspector/InspectorDOMStorageAgent.cpp: (WebCore::InspectorDOMStorageAgent::getDOMStorageItems): (WebCore::InspectorDOMStorageAgent::setDOMStorageItem): (WebCore::InspectorDOMStorageAgent::removeDOMStorageItem): (WebCore::InspectorDOMStorageAgent::storageId): (WebCore::InspectorDOMStorageAgent::findStorageArea): * inspector/InspectorDOMStorageAgent.h: * inspector/InspectorDatabaseAgent.cpp: Use Ref for all callbacks since they are not nullable. (WebCore::InspectorDatabaseAgent::executeSQL): * inspector/InspectorDatabaseAgent.h: * inspector/InspectorDatabaseInstrumentation.h: (WebCore::InspectorInstrumentation::didOpenDatabase): * inspector/InspectorDatabaseResource.cpp: (WebCore::InspectorDatabaseResource::create): (WebCore::InspectorDatabaseResource::InspectorDatabaseResource): (WebCore::InspectorDatabaseResource::bind): * inspector/InspectorDatabaseResource.h: (WebCore::InspectorDatabaseResource::setDatabase): * inspector/InspectorFrontendHost.h: (WebCore::InspectorFrontendHost::create): * inspector/InspectorIndexedDBAgent.cpp: Use Ref for all callbacks since they are not nullable. (WebCore::InspectorIndexedDBAgent::requestDatabaseNames): (WebCore::InspectorIndexedDBAgent::requestDatabase): (WebCore::InspectorIndexedDBAgent::requestData): (WebCore::ClearObjectStoreListener::create): (WebCore::ClearObjectStoreListener::ClearObjectStoreListener): (WebCore::ClearObjectStore::create): (WebCore::ClearObjectStore::ClearObjectStore): (WebCore::InspectorIndexedDBAgent::clearObjectStore): * inspector/InspectorIndexedDBAgent.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::willLoadXHRImpl): (WebCore::InspectorInstrumentation::addMessageToConsoleImpl): (WebCore::InspectorInstrumentation::consoleCountImpl): (WebCore::InspectorInstrumentation::stopConsoleTimingImpl): (WebCore::InspectorInstrumentation::consoleTimeStampImpl): (WebCore::InspectorInstrumentation::stopProfilingImpl): (WebCore::InspectorInstrumentation::didOpenDatabaseImpl): (WebCore::InspectorInstrumentation::sessionCreatedImpl): (WebCore::InspectorInstrumentation::sessionLoadedImpl): (WebCore::InspectorInstrumentation::sessionModifiedImpl): (WebCore::InspectorInstrumentation::segmentCreatedImpl): (WebCore::InspectorInstrumentation::segmentCompletedImpl): (WebCore::InspectorInstrumentation::segmentLoadedImpl): (WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl): Deleted. (WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl): Deleted. (WebCore::InspectorInstrumentation::startProfilingImpl): Deleted. (WebCore::InspectorInstrumentation::didDispatchDOMStorageEventImpl): Deleted. (WebCore::InspectorInstrumentation::willEvaluateWorkerScript): Deleted. (WebCore::InspectorInstrumentation::captureStoppedImpl): Deleted. (WebCore::InspectorInstrumentation::playbackStartedImpl): Deleted. (WebCore::InspectorInstrumentation::playbackPausedImpl): Deleted. (WebCore::InspectorInstrumentation::playbackHitPositionImpl): Deleted. (WebCore::InspectorInstrumentation::playbackFinishedImpl): Deleted. (WebCore::InspectorInstrumentation::networkStateChangedImpl): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::willLoadXHR): (WebCore::InspectorInstrumentation::sessionCreated): (WebCore::InspectorInstrumentation::sessionLoaded): (WebCore::InspectorInstrumentation::sessionModified): (WebCore::InspectorInstrumentation::segmentCreated): (WebCore::InspectorInstrumentation::segmentCompleted): (WebCore::InspectorInstrumentation::segmentLoaded): (WebCore::InspectorInstrumentation::documentThreadableLoaderStartedLoadingForClient): Deleted. (WebCore::InspectorInstrumentation::didSendWebSocketFrame): Deleted. * inspector/InspectorLayerTreeAgent.cpp: (WebCore::InspectorLayerTreeAgent::buildObjectForLayer): (WebCore::InspectorLayerTreeAgent::buildObjectForIntRect): (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer): * inspector/InspectorLayerTreeAgent.h: * inspector/InspectorOverlay.cpp: (WebCore::buildObjectForPoint): (WebCore::buildObjectForRect): (WebCore::buildArrayForQuad): (WebCore::buildObjectForHighlight): (WebCore::buildObjectForRegionHighlight): (WebCore::buildObjectForCSSRegionsHighlight): (WebCore::buildObjectForSize): (WebCore::buildObjectForCSSRegionContentClip): (WebCore::InspectorOverlay::drawPaintRects): (WebCore::buildObjectForRendererFragments): (WebCore::buildObjectForShapeOutside): (WebCore::buildObjectForElementInfo): (WebCore::InspectorOverlay::buildObjectForHighlightedNode): (WebCore::InspectorOverlay::reset): (WebCore::InspectorOverlay::evaluateInOverlay): * inspector/InspectorOverlay.h: * inspector/InspectorPageAgent.cpp: (WebCore::createXHRTextDecoder): (WebCore::buildObjectForCookie): (WebCore::buildArrayForCookies): (WebCore::buildObjectForSearchResult): (WebCore::InspectorPageAgent::buildObjectForFrame): (WebCore::InspectorPageAgent::buildObjectForFrameTree): * inspector/InspectorPageAgent.h: * inspector/InspectorReplayAgent.cpp: (WebCore::buildInspectorObjectForPosition): (WebCore::buildInspectorObjectForInput): (WebCore::buildInspectorObjectForSession): (WebCore::buildInspectorObjectForSegment): (WebCore::InspectorReplayAgent::replayToPosition): (WebCore::InspectorReplayAgent::getSessionData): (WebCore::InspectorReplayAgent::getSegmentData): * inspector/InspectorReplayAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::buildObjectForHeaders): (WebCore::buildObjectForTiming): (WebCore::buildObjectForResourceRequest): (WebCore::buildObjectForResourceResponse): (WebCore::buildObjectForCachedResource): (WebCore::InspectorResourceAgent::willLoadXHR): (WebCore::InspectorResourceAgent::buildInitiatorObject): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::setExtraHTTPHeaders): (WebCore::InspectorResourceAgent::loadResource): (WebCore::InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient): Deleted. (WebCore::InspectorResourceAgent::didScheduleStyleRecalculation): Deleted. (WebCore::InspectorResourceAgent::disable): Deleted. (WebCore::InspectorResourceAgent::setCacheDisabled): Deleted. * inspector/InspectorResourceAgent.h: * inspector/InspectorStyleSheet.cpp: (ParsedStyleSheet::ruleSourceDataAt): (WebCore::buildSourceRangeObject): (WebCore::buildMediaObject): (WebCore::asCSSRuleList): (WebCore::fillMediaListChain): (WebCore::InspectorStyle::create): (WebCore::InspectorStyle::InspectorStyle): (WebCore::InspectorStyle::buildObjectForStyle): (WebCore::InspectorStyle::buildArrayForComputedStyle): (WebCore::InspectorStyle::styleWithProperties): (WebCore::InspectorStyle::extractSourceData): (WebCore::InspectorStyleSheet::create): (WebCore::InspectorStyleSheet::InspectorStyleSheet): (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): (WebCore::InspectorStyleSheet::buildObjectForStyleSheetInfo): (WebCore::buildObjectForSelectorHelper): (WebCore::selectorsFromSource): (WebCore::InspectorStyleSheet::buildObjectForSelector): (WebCore::InspectorStyleSheet::buildObjectForSelectorList): (WebCore::InspectorStyleSheet::buildObjectForRule): (WebCore::InspectorStyleSheet::buildObjectForStyle): (WebCore::InspectorStyleSheet::toggleProperty): (WebCore::InspectorStyleSheet::inspectorStyleForId): (WebCore::InspectorStyleSheet::rememberInspectorStyle): (WebCore::InspectorStyleSheet::buildArrayForRuleList): (WebCore::InspectorStyleSheet::collectFlatRules): (WebCore::InspectorStyleSheetForInlineStyle::create): (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle): (WebCore::InspectorStyleSheetForInlineStyle::inspectorStyleForId): * inspector/InspectorStyleSheet.h: (WebCore::InspectorCSSId::InspectorCSSId): (WebCore::InspectorCSSId::asProtocolValue): * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::stopFromConsole): (WebCore::InspectorTimelineAgent::addRecordToTimeline): (WebCore::InspectorTimelineAgent::didCompleteRecordEntry): (WebCore::InspectorTimelineAgent::appendRecord): (WebCore::InspectorTimelineAgent::sendEvent): (WebCore::InspectorTimelineAgent::createRecordEntry): (WebCore::InspectorTimelineAgent::pushCurrentRecord): * inspector/InspectorTimelineAgent.h: * inspector/InspectorWorkerAgent.cpp: (WebCore::InspectorWorkerAgent::sendMessageToWorker): * inspector/InspectorWorkerAgent.h: * inspector/NetworkResourcesData.cpp: (WebCore::XHRReplayData::create): (WebCore::XHRReplayData::XHRReplayData): * inspector/NetworkResourcesData.h: (WebCore::NetworkResourcesData::ResourceData::decoder): (WebCore::NetworkResourcesData::ResourceData::setDecoder): (WebCore::NetworkResourcesData::ResourceData::buffer): (WebCore::NetworkResourcesData::ResourceData::setBuffer): * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createGenericRecord): (WebCore::TimelineRecordFactory::createBackgroundRecord): (WebCore::TimelineRecordFactory::createGCEventData): (WebCore::TimelineRecordFactory::createFunctionCallData): (WebCore::TimelineRecordFactory::createConsoleProfileData): (WebCore::TimelineRecordFactory::createProbeSampleData): (WebCore::TimelineRecordFactory::createEventDispatchData): (WebCore::TimelineRecordFactory::createGenericTimerData): (WebCore::TimelineRecordFactory::createTimerInstallData): (WebCore::TimelineRecordFactory::createXHRReadyStateChangeData): (WebCore::TimelineRecordFactory::createXHRLoadData): (WebCore::TimelineRecordFactory::createEvaluateScriptData): (WebCore::TimelineRecordFactory::createTimeStampData): (WebCore::TimelineRecordFactory::createScheduleResourceRequestData): (WebCore::TimelineRecordFactory::createResourceSendRequestData): (WebCore::TimelineRecordFactory::createResourceReceiveResponseData): (WebCore::TimelineRecordFactory::createResourceFinishData): (WebCore::TimelineRecordFactory::createReceiveResourceData): (WebCore::TimelineRecordFactory::createLayoutData): (WebCore::TimelineRecordFactory::createDecodeImageData): (WebCore::TimelineRecordFactory::createResizeImageData): (WebCore::TimelineRecordFactory::createMarkData): (WebCore::TimelineRecordFactory::createParseHTMLData): (WebCore::TimelineRecordFactory::createAnimationFrameData): (WebCore::createQuad): (WebCore::TimelineRecordFactory::createPaintData): (WebCore::buildInspectorObject): (WebCore::buildProfileInspectorObject): (WebCore::TimelineRecordFactory::appendProfile): * inspector/TimelineRecordFactory.h: (WebCore::TimelineRecordFactory::createWebSocketCreateData): (WebCore::TimelineRecordFactory::createGenericWebSocketData): * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::executionStopwatch): * inspector/WorkerInspectorController.h: * page/PageConsoleClient.cpp: (WebCore::PageConsoleClient::addMessage): (WebCore::PageConsoleClient::messageWithTypeAndLevel): (WebCore::PageConsoleClient::count): (WebCore::PageConsoleClient::profileEnd): (WebCore::PageConsoleClient::timeEnd): (WebCore::PageConsoleClient::timeStamp): * page/PageConsoleClient.h: * replay/ReplayController.cpp: (WebCore::ReplayController::switchSession): (WebCore::ReplayController::createSegment): (WebCore::ReplayController::completeSegment): (WebCore::ReplayController::loadSegmentAtIndex): * replay/ReplayInputCreationMethods.cpp: (WebCore::InitialNavigation::createFromPage): * workers/SharedWorkerGlobalScope.cpp: (WebCore::SharedWorkerGlobalScope::logExceptionToConsole): * workers/SharedWorkerGlobalScope.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::logExceptionToConsole): (WebCore::WorkerGlobalScope::addMessage): (WebCore::WorkerGlobalScope::addMessageToWorkerConsole): * workers/WorkerGlobalScope.h: Source/WebKit: * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: update symbol. Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::create): Return a Ref. Canonical link: https://commits.webkit.org/158174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-01-07 23:29:03 +00:00
return adoptRef(*new Stopwatch());
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
}
void reset();
void start();
void stop();
ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting https://bugs.webkit.org/show_bug.cgi?id=203638 <rdar://problem/56761893> Reviewed by Brian Burg. Source/JavaScriptCore: Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::executionStopwatch const): Added. (Inspector::JSGlobalObjectInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorHeapAgent.cpp: (Inspector::InspectorHeapAgent::snapshot): (Inspector::InspectorHeapAgent::willGarbageCollect): (Inspector::InspectorHeapAgent::didGarbageCollect): * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::startTracking): (Inspector::InspectorScriptProfilerAgent::willEvaluateScript): (Inspector::InspectorScriptProfilerAgent::didEvaluateScript): (Inspector::InspectorScriptProfilerAgent::trackingComplete): * runtime/SamplingProfiler.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::SamplingProfiler): * runtime/VM.h: * runtime/VM.cpp: (JSC::VM::ensureSamplingProfiler): Source/WebCore: Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorController.h: * inspector/InspectorController.cpp: (WebCore::InspectorController::executionStopwatch const): Added. (WebCore::InspectorController::executionStopwatch): Deleted. * inspector/WorkerInspectorController.h: (WebCore::WorkerInspectorController::executionStopwatch const): Added. (WebCore::WorkerInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::InspectorAnimationAgent::startTracking): (WebCore::InspectorAnimationAgent::stopTracking): (WebCore::InspectorAnimationAgent::willApplyKeyframeEffect): (WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation): * inspector/agents/InspectorCPUProfilerAgent.cpp: (WebCore::InspectorCPUProfilerAgent::startTracking): (WebCore::InspectorCPUProfilerAgent::stopTracking): (WebCore::InspectorCPUProfilerAgent::collectSample): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::mediaMetricsTimerFired): * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::startTracking): (WebCore::InspectorMemoryAgent::stopTracking): (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::enable): (WebCore::InspectorPageAgent::timestamp): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::timestamp): Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTime const): Added. (WTF::Stopwatch::elapsedTimeSince const): Added. (WTF::Stopwatch::elapsedTime): Deleted. (WTF::Stopwatch::elapsedTimeSince): Deleted. Canonical link: https://commits.webkit.org/224406@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261233 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-06 16:15:16 +00:00
Seconds elapsedTime() const;
Seconds elapsedTimeSince(MonotonicTime) const;
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
bool isActive() const { return !std::isnan(m_lastStartTime); }
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
private:
Stopwatch() { reset(); }
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
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
2018-03-02 17:13:32 +00:00
Seconds m_elapsedTime;
MonotonicTime m_lastStartTime;
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
};
inline void Stopwatch::reset()
{
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
2018-03-02 17:13:32 +00:00
m_elapsedTime = 0_s;
m_lastStartTime = MonotonicTime::nan();
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
}
inline void Stopwatch::start()
{
ASSERT_WITH_MESSAGE(std::isnan(m_lastStartTime), "Tried to start the stopwatch, but it is already running.");
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
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
2018-03-02 17:13:32 +00:00
m_lastStartTime = MonotonicTime::now();
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
}
inline void Stopwatch::stop()
{
ASSERT_WITH_MESSAGE(!std::isnan(m_lastStartTime), "Tried to stop the stopwatch, but it is not running.");
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
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
2018-03-02 17:13:32 +00:00
m_elapsedTime += MonotonicTime::now() - m_lastStartTime;
m_lastStartTime = MonotonicTime::nan();
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
}
ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting https://bugs.webkit.org/show_bug.cgi?id=203638 <rdar://problem/56761893> Reviewed by Brian Burg. Source/JavaScriptCore: Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::executionStopwatch const): Added. (Inspector::JSGlobalObjectInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorHeapAgent.cpp: (Inspector::InspectorHeapAgent::snapshot): (Inspector::InspectorHeapAgent::willGarbageCollect): (Inspector::InspectorHeapAgent::didGarbageCollect): * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::startTracking): (Inspector::InspectorScriptProfilerAgent::willEvaluateScript): (Inspector::InspectorScriptProfilerAgent::didEvaluateScript): (Inspector::InspectorScriptProfilerAgent::trackingComplete): * runtime/SamplingProfiler.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::SamplingProfiler): * runtime/VM.h: * runtime/VM.cpp: (JSC::VM::ensureSamplingProfiler): Source/WebCore: Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorController.h: * inspector/InspectorController.cpp: (WebCore::InspectorController::executionStopwatch const): Added. (WebCore::InspectorController::executionStopwatch): Deleted. * inspector/WorkerInspectorController.h: (WebCore::WorkerInspectorController::executionStopwatch const): Added. (WebCore::WorkerInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::InspectorAnimationAgent::startTracking): (WebCore::InspectorAnimationAgent::stopTracking): (WebCore::InspectorAnimationAgent::willApplyKeyframeEffect): (WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation): * inspector/agents/InspectorCPUProfilerAgent.cpp: (WebCore::InspectorCPUProfilerAgent::startTracking): (WebCore::InspectorCPUProfilerAgent::stopTracking): (WebCore::InspectorCPUProfilerAgent::collectSample): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::mediaMetricsTimerFired): * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::startTracking): (WebCore::InspectorMemoryAgent::stopTracking): (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::enable): (WebCore::InspectorPageAgent::timestamp): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::timestamp): Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTime const): Added. (WTF::Stopwatch::elapsedTimeSince const): Added. (WTF::Stopwatch::elapsedTime): Deleted. (WTF::Stopwatch::elapsedTimeSince): Deleted. Canonical link: https://commits.webkit.org/224406@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261233 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-06 16:15:16 +00:00
inline Seconds Stopwatch::elapsedTime() const
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
{
if (!isActive())
return m_elapsedTime;
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
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
2018-03-02 17:13:32 +00:00
return m_elapsedTime + (MonotonicTime::now() - m_lastStartTime);
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
}
ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread()) when web inspecting https://bugs.webkit.org/show_bug.cgi?id=203638 <rdar://problem/56761893> Reviewed by Brian Burg. Source/JavaScriptCore: Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::executionStopwatch const): Added. (Inspector::JSGlobalObjectInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorHeapAgent.cpp: (Inspector::InspectorHeapAgent::snapshot): (Inspector::InspectorHeapAgent::willGarbageCollect): (Inspector::InspectorHeapAgent::didGarbageCollect): * inspector/agents/InspectorScriptProfilerAgent.cpp: (Inspector::InspectorScriptProfilerAgent::startTracking): (Inspector::InspectorScriptProfilerAgent::willEvaluateScript): (Inspector::InspectorScriptProfilerAgent::didEvaluateScript): (Inspector::InspectorScriptProfilerAgent::trackingComplete): * runtime/SamplingProfiler.h: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::SamplingProfiler): * runtime/VM.h: * runtime/VM.cpp: (JSC::VM::ensureSamplingProfiler): Source/WebCore: Mark the `InspectorEnvironment::executionStopwatch` abstract function as `const` and have it return a `Stopwatch&` instead of a `RefPtr<Stopwatch>&` as callers assume that it exists. By not using a `RefPtr`, an additional `copyRef` can be avoided. * inspector/InspectorController.h: * inspector/InspectorController.cpp: (WebCore::InspectorController::executionStopwatch const): Added. (WebCore::InspectorController::executionStopwatch): Deleted. * inspector/WorkerInspectorController.h: (WebCore::WorkerInspectorController::executionStopwatch const): Added. (WebCore::WorkerInspectorController::executionStopwatch): Deleted. * inspector/agents/InspectorAnimationAgent.cpp: (WebCore::InspectorAnimationAgent::startTracking): (WebCore::InspectorAnimationAgent::stopTracking): (WebCore::InspectorAnimationAgent::willApplyKeyframeEffect): (WebCore::InspectorAnimationAgent::stopTrackingDeclarativeAnimation): * inspector/agents/InspectorCPUProfilerAgent.cpp: (WebCore::InspectorCPUProfilerAgent::startTracking): (WebCore::InspectorCPUProfilerAgent::stopTracking): (WebCore::InspectorCPUProfilerAgent::collectSample): * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::mediaMetricsTimerFired): * inspector/agents/InspectorMemoryAgent.cpp: (WebCore::InspectorMemoryAgent::startTracking): (WebCore::InspectorMemoryAgent::stopTracking): (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::enable): (WebCore::InspectorPageAgent::timestamp): * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::timestamp): Source/WTF: * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTime const): Added. (WTF::Stopwatch::elapsedTimeSince const): Added. (WTF::Stopwatch::elapsedTime): Deleted. (WTF::Stopwatch::elapsedTimeSince): Deleted. Canonical link: https://commits.webkit.org/224406@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261233 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-06 16:15:16 +00:00
inline Seconds Stopwatch::elapsedTimeSince(MonotonicTime timeStamp) const
Web Inspector: Frontend should have access to Resource Timing information https://bugs.webkit.org/show_bug.cgi?id=160095 Patch by Johan K. Jensen <johan_jensen@apple.com> on 2016-08-26 Reviewed by Alex Christensen. Source/JavaScriptCore: Rename ResourceTiming property. * inspector/protocol/Network.json: Rename navigationStart to startTime so it's applicable for all resources and not just the main resource. Source/WebCore: Show correct information with Resource Timing information from ResourceLoader rather than DocumentLoader. No new tests, frontend doesn't use the timing data yet. * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): (WebCore::InspectorNetworkAgent::buildObjectForCachedResource): (WebCore::InspectorNetworkAgent::willSendRequest): (WebCore::InspectorNetworkAgent::didReceiveResponse): (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache): (WebCore::buildObjectForTiming): Deleted. (WebCore::buildObjectForResourceResponse): Deleted. (WebCore::buildObjectForCachedResource): Deleted. Use ResourceLoader instead of DocumentLoader to get Resource Timing information. Move functions to member functions to access the executionStopWatch. (WebCore::InspectorNetworkAgent::didFinishLoading): Use the load timing finishTime and convert to elapsed time for frontend. * inspector/InspectorNetworkAgent.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): Pass the web process load timing on to the inspector. Source/WTF: Add method to get elapsed time for any monotonic time. Used by InspectorNetworkAgent. * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Canonical link: https://commits.webkit.org/179438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205062 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-27 00:30:00 +00:00
{
if (!isActive())
return m_elapsedTime;
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
2018-03-02 17:13:32 +00:00
return m_elapsedTime + (timeStamp - m_lastStartTime);
Web Inspector: Frontend should have access to Resource Timing information https://bugs.webkit.org/show_bug.cgi?id=160095 Patch by Johan K. Jensen <johan_jensen@apple.com> on 2016-08-26 Reviewed by Alex Christensen. Source/JavaScriptCore: Rename ResourceTiming property. * inspector/protocol/Network.json: Rename navigationStart to startTime so it's applicable for all resources and not just the main resource. Source/WebCore: Show correct information with Resource Timing information from ResourceLoader rather than DocumentLoader. No new tests, frontend doesn't use the timing data yet. * inspector/InspectorNetworkAgent.cpp: (WebCore::InspectorNetworkAgent::buildObjectForTiming): (WebCore::InspectorNetworkAgent::buildObjectForResourceResponse): (WebCore::InspectorNetworkAgent::buildObjectForCachedResource): (WebCore::InspectorNetworkAgent::willSendRequest): (WebCore::InspectorNetworkAgent::didReceiveResponse): (WebCore::InspectorNetworkAgent::didLoadResourceFromMemoryCache): (WebCore::buildObjectForTiming): Deleted. (WebCore::buildObjectForResourceResponse): Deleted. (WebCore::buildObjectForCachedResource): Deleted. Use ResourceLoader instead of DocumentLoader to get Resource Timing information. Move functions to member functions to access the executionStopWatch. (WebCore::InspectorNetworkAgent::didFinishLoading): Use the load timing finishTime and convert to elapsed time for frontend. * inspector/InspectorNetworkAgent.h: * loader/SubresourceLoader.cpp: (WebCore::SubresourceLoader::didFinishLoading): Pass the web process load timing on to the inspector. Source/WTF: Add method to get elapsed time for any monotonic time. Used by InspectorNetworkAgent. * wtf/Stopwatch.h: (WTF::Stopwatch::elapsedTimeSinceMonotonicTime): Canonical link: https://commits.webkit.org/179438@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205062 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-08-27 00:30:00 +00:00
}
Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Source/JavaScriptCore: Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: Source/WebCore: To avoid counting time elapsed while the debugger is paused, timeline records should keep track of time elapsed since the start of timeline capturing, rather than wall clock timestamps. We can easily compute elapsed time by sharing a Stopwatch instance through the inspector environment. The stopwatch runs with timelines and is paused with the debugger, so subsequent time measurements will not include time elapsed while the debugger is paused. This refactoring is safe because start and end times are only used to graph records; the timestamp's actual value is irrelevant and is not displayed in the user interface. Date timestamps are still included with network-related records as part of their header data. No new tests, because we cannot reliably test timing changes induced by debugger pauses. It is possible for records to accrue time before the debugger pauses or after it resumes. * inspector/InspectorCSSAgent.cpp: Remove unnecessary include. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): (WebCore::InspectorController::executionStopwatch): Add a shared stopwatch. * inspector/InspectorController.h: * inspector/InspectorPageAgent.cpp: (WebCore::InspectorPageAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorPageAgent::domContentEventFired): (WebCore::InspectorPageAgent::loadEventFired): * inspector/InspectorPageAgent.h: * inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::timestamp): Redirect to the shared stopwatch. (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didReceiveData): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didLoadResourceFromMemoryCache): (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest): (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorResourceAgent::didCloseWebSocket): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrame): (WebCore::InspectorResourceAgent::didSendWebSocketFrame): (WebCore::InspectorResourceAgent::didReceiveWebSocketFrameError): * inspector/InspectorResourceAgent.h: * inspector/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): Start and stop the stopwatch with timelines. (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::timestamp): Redirect to the shared stopwatch. (WebCore::startProfiling): (WebCore::InspectorTimelineAgent::startFromConsole): (WebCore::InspectorTimelineAgent::willCallFunction): (WebCore::InspectorTimelineAgent::willEvaluateScript): (WebCore::TimelineTimeConverter::reset): Deleted. * inspector/InspectorTimelineAgent.h: (WebCore::TimelineTimeConverter::TimelineTimeConverter): Deleted. (WebCore::TimelineTimeConverter::fromMonotonicallyIncreasingTime): Deleted. (WebCore::InspectorTimelineAgent::timeConverter): Deleted. * inspector/TimelineRecordFactory.cpp: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::executionStopwatch): Add a shared stopwatch. * inspector/WorkerInspectorController.h: Source/WebInspectorUI: Don't update the timeline's current time when the debugger is paused. Start and end times for timeline records are now in seconds elapsed since timeline recording started, rather than milliseconds since the epoch. Also convert code that tracks page/resource load timings to use elapsed times rather than timestamps. Add a workaround to preserve compatibility with old backends. Convert legacy timestamps in multiple agents to elapsed times. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype.resourceRequestWillBeSent): (WebInspector.FrameResourceManager.prototype.resourceRequestWasServedFromMemoryCache): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveResponse): (WebInspector.FrameResourceManager.prototype.resourceRequestDidReceiveData): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFinishLoading): (WebInspector.FrameResourceManager.prototype.resourceRequestDidFailLoading): (WebInspector.FrameResourceManager.prototype._addNewResourceToFrame): * UserInterface/Controllers/ProbeManager.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype.computeElapsedTime): Forward to the active TimelineRecording. (WebInspector.TimelineManager.prototype.eventRecorded.processRecord): (WebInspector.TimelineManager.prototype.eventRecorded): (WebInspector.TimelineManager.prototype.pageDidLoad): (WebInspector.TimelineManager.prototype._loadNewRecording): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Models/Resource.js: (WebInspector.Resource.prototype.updateForRedirectResponse): (WebInspector.Resource.prototype.updateForResponse): (WebInspector.Resource.prototype.increaseSize): (WebInspector.Resource.prototype.markAsFinished): (WebInspector.Resource.prototype.markAsFailed): (WebInspector.Resource.prototype.revertMarkAsFinished): * UserInterface/Models/TimelineRecording.js: (WebInspector.TimelineRecording.prototype.computeElapsedTime): * UserInterface/Views/TimelineContentView.js: (WebInspector.TimelineContentView.prototype._debuggerPaused): (WebInspector.TimelineContentView.prototype._debuggerResumed): Source/WTF: * WTF.vcxproj/WTF.vcxproj: * WTF.vcxproj/WTF.vcxproj.filters: * WTF.xcodeproj/project.pbxproj: * wtf/CMakeLists.txt: * wtf/Stopwatch.h: Added. This implements a refcounted monotonic stopwatch. (WTF::Stopwatch::create): (WTF::Stopwatch::Stopwatch): (WTF::Stopwatch::reset): (WTF::Stopwatch::start): (WTF::Stopwatch::stop): (WTF::Stopwatch::elapsedTime): Canonical link: https://commits.webkit.org/155938@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175203 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-10-25 22:05:57 +00:00
} // namespace WTF
using WTF::Stopwatch;