Support Performance API (performance.now(), UserTiming) in Workers
https://bugs.webkit.org/show_bug.cgi?id=167717
Reviewed by Ryosuke Niwa.
Source/WebCore:
Tests: performance-api/performance-mark-name.html
performance-api/performance-now-api.html
performance-api/performance-now-time-origin-in-worker.html
performance-api/user-timing-apis.html
* CMakeLists.txt:
* DerivedSources.make:
New files.
* page/DOMWindow.idl:
* page/GlobalPerformance.idl:
* workers/WorkerGlobalScope.idl:
Add partial interface for performance attribute.
* page/Performance.idl:
* page/PerformanceEntry.idl:
* page/PerformanceMark.idl:
* page/PerformanceMeasure.idl:
* page/PerformanceObserver.idl:
* page/PerformanceObserverEntryList.idl:
Expose these to Workers.
* page/Performance.cpp:
(WebCore::Performance::Performance):
(WebCore::Performance::contextDestroyed):
* page/Performance.h:
Use the EventQueue variant that works with any ScriptExectionContext.
* page/PerformanceObserver.cpp:
(WebCore::PerformanceObserver::PerformanceObserver):
Get the Performance base in a Worker context.
* page/PerformanceUserTiming.cpp:
(WebCore::UserTiming::mark):
Only reject legacy special mark names in a Window, not a Worker.
(WebCore::UserTiming::findExistingMarkStartTime):
Simple implementation returns 0 as the start time in Workers. The spec
is currently imprecise here, but it does not have the unusual
PerformanceTiming behavior in a Window which is part of User Timing 1.
* workers/Worker.cpp:
(WebCore::Worker::create):
(WebCore::Worker::notifyFinished):
* workers/Worker.h:
Record the moment of Worker creation.
* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::WorkerGlobalScope):
(WebCore::WorkerGlobalScope::performance):
* workers/WorkerGlobalScope.h:
Construct the Performance object with the moment of creation (timeOrigin).
* 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/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::workerThread):
* workers/WorkerThread.h:
Pass the moment of creation (timeOrigin) through to WorkerGlobalScope creation.
LayoutTests:
* js/dom/global-constructors-attributes-dedicated-worker-expected.txt:
Updated now that Performance classes are in Workers.
* performance-api/performance-now-api-expected.txt: Added.
* performance-api/performance-now-api.html: Added.
* performance-api/performance-now-time-origin-in-worker-expected.txt: Added.
* performance-api/performance-now-time-origin-in-worker.html: Added.
New tests to cover performance.now.
* performance-api/performance-mark-name-expected.txt: Added.
* performance-api/performance-mark-name.html: Added.
* performance-api/resources/mark-name.js: Added.
* performance-api/resources/user-timing-api.js: Added.
* performance-api/user-timing-apis-expected.txt: Added.
* performance-api/user-timing-apis.html: Added.
New tests to cover user-timing and performance.mark behavior.
* performance-api/performance-observer-api-expected.txt:
* performance-api/performance-observer-api.html:
* performance-api/performance-observer-basic-expected.txt:
* performance-api/performance-observer-basic.html:
* performance-api/performance-timeline-api-expected.txt:
* performance-api/performance-timeline-api.html:
* performance-api/resources/now-api.js: Added.
* performance-api/resources/observer-api.js: Copied from LayoutTests/performance-api/performance-observer-api.html.
* performance-api/resources/observer-basic.js: Copied from LayoutTests/performance-api/performance-observer-basic.html.
* performance-api/resources/time-origin-in-worker.js: Added.
* performance-api/resources/timeline-api.js: Copied from LayoutTests/performance-api/performance-timeline-api.html.
Update some of the existing tests to check in a Document and Worker.
* imported/w3c/web-platform-tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes-expected.txt:
Minor progression.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@211594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
53 files changed