haikuwebkit/Source/WebCore/page/PerformanceMark.idl

33 lines
1.6 KiB
Plaintext
Raw Permalink Normal View History

Source/WebCore: [User Timing] implement main interface in of User Timing, according to http://www.w3.org/TR/2012/CR-user-timing-20120726/ https://bugs.webkit.org/show_bug.cgi?id=90963 Patch by Pan Deng <pan.deng@intel.com> on 2012-10-17 Reviewed by Tony Gentilcore. This patch implemented mark(), measure(), clearMarks() and clearMeasures() interface of User Timing. Getters are not exposed by Performance Timeline yet, it will be future patch. Tests: http/tests/w3c/webperf/submission/user-timing/test_user_timing_clearMarks.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_clearMeasures.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_mark.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_mark_exception.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure_associate_with_navigation_timing.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure_exception.html http/tests/w3c/webperf/submission/user-timing/test_user_timing_method_exist.html * GNUmakefile.list.am: * WebCore.gypi: * page/Performance.cpp: (WebCore::Performance::webkitGetEntries): (WebCore::Performance::webkitGetEntriesByType): (WebCore::Performance::webkitGetEntriesByName): (WebCore): (WebCore::Performance::webkitMark): (WebCore::Performance::webkitClearMarks): (WebCore::Performance::webkitMeasure): (WebCore::Performance::webkitClearMeasures): * page/Performance.h: (WebCore): (Performance): * page/Performance.idl: * page/PerformanceMark.h: Added. (WebCore): (PerformanceMark): (WebCore::PerformanceMark::create): (WebCore::PerformanceMark::PerformanceMark): (WebCore::PerformanceMark::~PerformanceMark): * page/PerformanceMark.idl: Added. * page/PerformanceMeasure.h: Added. (WebCore): (PerformanceMeasure): (WebCore::PerformanceMeasure::create): (WebCore::PerformanceMeasure::PerformanceMeasure): (WebCore::PerformanceMeasure::~PerformanceMeasure): * page/PerformanceMeasure.idl: Added. * page/PerformanceUserTiming.cpp: Added. (WebCore): (WebCore::UserTiming::UserTiming): (WebCore::insertPerformanceEntry): (WebCore::clearPeformanceEntries): (WebCore::UserTiming::mark): (WebCore::UserTiming::clearMarks): (WebCore::UserTiming::findExistingMarkStartTime): (WebCore::UserTiming::measure): (WebCore::UserTiming::clearMeasures): * page/PerformanceUserTiming.h: Added. (WebCore): (UserTiming): (WebCore::UserTiming::create): LayoutTests: [User Timing] Test Cases of User Timing. According to http://www.w3.org/TR/2012/CR-user-timing-20120726/ https://bugs.webkit.org/show_bug.cgi?id=90963 Patch by Pan Deng <pan.deng@intel.com> on 2012-10-17 Reviewed by Tony Gentilcore. Test cases in this patch validate functionality of W3C User Timing interface. These test cases use W3C testharness. Since User Timing feature is not enabled in any platform yet, all skipped currenttly. * http/tests/w3c/webperf/resources/webperftestharnessextension.js: Added. (test_method_exists): (test_noless_than): (performance_entrylist_checker.entry_check.test_equals): (performance_entrylist_checker.entry_check): (performance_entrylist_checker.entrylist_order_check): (performance_entrylist_checker.entrylist_check): (PerformanceContext): (PerformanceContext.prototype.initialMeasures): (PerformanceContext.prototype.mark): (PerformanceContext.prototype.measure): (PerformanceContext.prototype.clearMarks): (PerformanceContext.prototype.clearMeasures): (PerformanceContext.prototype.getEntries): (PerformanceContext.prototype.getEntriesByType): (PerformanceContext.prototype.getEntriesByName): * http/tests/w3c/webperf/submission/user-timing/test_user_timing_clearMarks-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_clearMarks.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_clearMeasures-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_clearMeasures.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_mark-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_mark.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_mark_exception-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_mark_exception.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure_associate_with_navigation_timing-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure_associate_with_navigation_timing.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure_exception-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_measure_exception.html: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_method_exist-expected.txt: Added. * http/tests/w3c/webperf/submission/user-timing/test_user_timing_method_exist.html: Added. * platform/chromium/TestExpectations: * platform/efl/TestExpectations: * platform/gtk/TestExpectations: * platform/mac/TestExpectations: * platform/qt-5.0-wk2/TestExpectations: * platform/qt/TestExpectations: * platform/win/TestExpectations: Canonical link: https://commits.webkit.org/117647@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131693 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-10-18 01:56:10 +00:00
/*
* Copyright (C) 2012 Intel Inc. 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 INC. ``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 INC. OR
* 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.
*/
// https://w3c.github.io/user-timing/#performancemark
[
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. Canonical link: https://commits.webkit.org/184803@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211594 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-02 22:07:28 +00:00
Exposed=(Window,Worker),
] interface PerformanceMark : PerformanceEntry {
Update User Timing interfaces to User Timing Level 3 https://bugs.webkit.org/show_bug.cgi?id=216787 Reviewed by Alex Christensen. LayoutTests/imported/w3c: Import missing case-sensitivity test case from upstream and update the results of User Timing tests now that we support Level 3. * web-platform-tests/user-timing/case-sensitivity.any-expected.txt: Added. * web-platform-tests/user-timing/case-sensitivity.any.html: Added. * web-platform-tests/user-timing/case-sensitivity.any.js: Added. * web-platform-tests/user-timing/case-sensitivity.any.worker-expected.txt: Added. * web-platform-tests/user-timing/case-sensitivity.any.worker.html: Added. * web-platform-tests/user-timing/idlharness.any-expected.txt: * web-platform-tests/user-timing/idlharness.any.worker-expected.txt: * web-platform-tests/user-timing/mark-entry-constructor.any-expected.txt: * web-platform-tests/user-timing/mark-entry-constructor.any.worker-expected.txt: * web-platform-tests/user-timing/mark-errors.any-expected.txt: * web-platform-tests/user-timing/mark-errors.any.worker-expected.txt: * web-platform-tests/user-timing/mark-l3.any-expected.txt: * web-platform-tests/user-timing/mark-l3.any.worker-expected.txt: * web-platform-tests/user-timing/mark-measure-return-objects.any-expected.txt: * web-platform-tests/user-timing/mark-measure-return-objects.any.worker-expected.txt: * web-platform-tests/user-timing/measure-l3.any-expected.txt: * web-platform-tests/user-timing/measure-l3.any.worker-expected.txt: * web-platform-tests/user-timing/measure-with-dict.any-expected.txt: * web-platform-tests/user-timing/measure-with-dict.any.worker-expected.txt: * web-platform-tests/user-timing/measure_exception-expected.txt: * web-platform-tests/user-timing/performance-measure-invalid.worker-expected.txt: * web-platform-tests/user-timing/structured-serialize-detail.any-expected.txt: * web-platform-tests/user-timing/structured-serialize-detail.any.worker-expected.txt: Source/WebCore: Adds support for User Timing Level 3 which adds more flexibility in how PerformanceMarks and PerformanceMeasures are created via synthetic start/end times and associate 'details' values serialized with events themselves. Updates results to existing WPT and standalone tests. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Sources.txt: * WebCore.xcodeproj/project.pbxproj: Add new files. * page/Performance.cpp: (WebCore::Performance::mark): (WebCore::Performance::clearMarks): (WebCore::Performance::measure): (WebCore::Performance::clearMeasures): * page/Performance.h: * page/Performance.idl: Update for new signatures for mark and measure, and rename of UserTiming to PerformanceUserTiming. * page/PerformanceMark.cpp: Added. (WebCore::peformanceNow): (WebCore::PerformanceMark::create): (WebCore::PerformanceMark::PerformanceMark): (WebCore::PerformanceMark::detail): * page/PerformanceMark.h: * page/PerformanceMark.idl: Add support for PerformanceMark's constructor `detail` getter. While the spec says to serialize and the deserialize in the constructor, we only serialize, and delay deserialization until the first access, which is a non-observable difference. We also utilize [CachedAttribute] to only ever deserialize once per wrapper world (and also greatly simplify the GC shenanigans). * page/PerformanceMarkOptions.h: Added. * page/PerformanceMarkOptions.idl: Added. Import and bind PerformanceMarkOptions dictionary to a new struct. * page/PerformanceMeasure.cpp: Added. (WebCore::PerformanceMeasure::create): (WebCore::PerformanceMeasure::PerformanceMeasure): (WebCore::PerformanceMeasure::detail): * page/PerformanceMeasure.h: * page/PerformanceMeasure.idl: Like with PerformanceMark, but there is no constructor here, so we only need to handle adding support for the detail getter. * page/PerformanceMeasureOptions.h: Added. * page/PerformanceMeasureOptions.idl: Added. Import and bind PerformanceMeasureOptions dictionary to a new struct. * page/PerformanceUserTiming.cpp: (WebCore::restrictedMarkNamesToNavigationTimingFunctionMap): (WebCore::restrictedMarkFunction): (WebCore::isRestrictedMarkNameNonMainThread): (WebCore::PerformanceUserTiming::isRestrictedMarkName): Split up existing map to enable accessing it safely from a worker using conservative callOnMainThreadAndWait approach, though since the map is immutable after initialization, we can probably optimize this to allow concurrent querying in the future. (WebCore::addPerformanceEntry): Add helper, mirroring clearPerformanceEntries, to add entries. (WebCore::PerformanceUserTiming::mark): Matching the spec language, utilize the new PerformanceMark constructor to create the mark. (WebCore::PerformanceUserTiming::convertMarkToTimestamp const): (WebCore::isNonEmptyDictionary): (WebCore::PerformanceUserTiming::measure): Implement measure support by dispatching various combinations of arguments to overloads manually by inspecting the Variant. * page/PerformanceUserTiming.h: Renames class from UserTiming to PerformanceUserTiming to match file names. LayoutTests: Update error text due to some changes in which exceptions are thrown due to new support for User Timing Level 3. * performance-api/performance-measure-name-expected.txt: * performance-api/performance-now-api-expected.txt: * performance-api/user-timing-apis-expected.txt: Canonical link: https://commits.webkit.org/229612@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267402 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-22 08:46:36 +00:00
[CallWith=GlobalObject&ScriptExecutionContext] constructor(DOMString markName, optional PerformanceMarkOptions markOptions);
[CallWith=GlobalObject, CachedAttribute] readonly attribute any detail;
};