Changeset 259298 in webkit
- Timestamp:
- Mar 31, 2020, 10:35:30 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r259296 r259298 1 2020-03-31 Chris Lord <clord@igalia.com> 2 3 requestAnimationFrame and cancelAnimationFrame should be present on DedicatedWorkerGlobalScope 4 https://bugs.webkit.org/show_bug.cgi?id=202525 5 6 Reviewed by Simon Fraser. 7 8 Add PASS expectations for DedicatedWorkerGlobalScope.AnimationFrameProvider on platforms where 9 OffscreenCanvas is enabled. 10 11 * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt: Added. 12 * platform/gtk/imported/w3c/web-platform-tests/workers/WorkerGlobalScope_requestAnimationFrame.tentative.worker-expected.txt: Added. 13 * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt: Added. 14 * platform/wpe/imported/w3c/web-platform-tests/workers/WorkerGlobalScope_requestAnimationFrame.tentative.worker-expected.txt: Added. 15 1 16 2020-03-31 Zalan Bujtas <zalan@apple.com> 2 17 -
trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt
r254504 r259298 634 634 PASS DedicatedWorkerGlobalScope interface: attribute onmessage 635 635 FAIL DedicatedWorkerGlobalScope interface: attribute onmessageerror assert_own_property: The global object must have a property "onmessageerror" expected property "onmessageerror" missing 636 FAIL DedicatedWorkerGlobalScope interface: operation requestAnimationFrame(FrameRequestCallback) assert_own_property: global object missing non-static operation expected property "requestAnimationFrame" missing 637 FAIL DedicatedWorkerGlobalScope interface: operation cancelAnimationFrame(unsigned long) assert_own_property: global object missing non-static operation expected property "cancelAnimationFrame" missing 636 PASS DedicatedWorkerGlobalScope interface: operation requestAnimationFrame(FrameRequestCallback) 637 PASS DedicatedWorkerGlobalScope interface: operation cancelAnimationFrame(unsigned long) 638 638 PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via Object.setPrototypeOf should throw a TypeError 639 639 PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via __proto__ should throw a TypeError … … 652 652 PASS DedicatedWorkerGlobalScope interface: self must inherit property "onmessage" with the proper type 653 653 FAIL DedicatedWorkerGlobalScope interface: self must inherit property "onmessageerror" with the proper type assert_own_property: expected property "onmessageerror" missing 654 FAIL DedicatedWorkerGlobalScope interface: self must inherit property "requestAnimationFrame(FrameRequestCallback)" with the proper type assert_own_property: expected property "requestAnimationFrame" missing 655 FAIL DedicatedWorkerGlobalScope interface: calling requestAnimationFrame(FrameRequestCallback) on self with too few arguments must throw TypeError assert_own_property: expected property "requestAnimationFrame" missing 656 FAIL DedicatedWorkerGlobalScope interface: self must inherit property "cancelAnimationFrame(unsigned long)" with the proper type assert_own_property: expected property "cancelAnimationFrame" missing 657 FAIL DedicatedWorkerGlobalScope interface: calling cancelAnimationFrame(unsigned long) on self with too few arguments must throw TypeError assert_own_property: expected property "cancelAnimationFrame" missing 654 PASS DedicatedWorkerGlobalScope interface: self must inherit property "requestAnimationFrame(FrameRequestCallback)" with the proper type 655 PASS DedicatedWorkerGlobalScope interface: calling requestAnimationFrame(FrameRequestCallback) on self with too few arguments must throw TypeError 656 PASS DedicatedWorkerGlobalScope interface: self must inherit property "cancelAnimationFrame(unsigned long)" with the proper type 657 PASS DedicatedWorkerGlobalScope interface: calling cancelAnimationFrame(unsigned long) on self with too few arguments must throw TypeError 658 658 PASS WorkerGlobalScope interface: self must inherit property "self" with the proper type 659 659 PASS WorkerGlobalScope interface: self must inherit property "location" with the proper type -
trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt
r255152 r259298 634 634 PASS DedicatedWorkerGlobalScope interface: attribute onmessage 635 635 FAIL DedicatedWorkerGlobalScope interface: attribute onmessageerror assert_own_property: The global object must have a property "onmessageerror" expected property "onmessageerror" missing 636 FAIL DedicatedWorkerGlobalScope interface: operation requestAnimationFrame(FrameRequestCallback) assert_own_property: global object missing non-static operation expected property "requestAnimationFrame" missing 637 FAIL DedicatedWorkerGlobalScope interface: operation cancelAnimationFrame(unsigned long) assert_own_property: global object missing non-static operation expected property "cancelAnimationFrame" missing 636 PASS DedicatedWorkerGlobalScope interface: operation requestAnimationFrame(FrameRequestCallback) 637 PASS DedicatedWorkerGlobalScope interface: operation cancelAnimationFrame(unsigned long) 638 638 PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via Object.setPrototypeOf should throw a TypeError 639 639 PASS DedicatedWorkerGlobalScope interface: internal [[SetPrototypeOf]] method of global platform object - setting to a new value via __proto__ should throw a TypeError … … 652 652 PASS DedicatedWorkerGlobalScope interface: self must inherit property "onmessage" with the proper type 653 653 FAIL DedicatedWorkerGlobalScope interface: self must inherit property "onmessageerror" with the proper type assert_own_property: expected property "onmessageerror" missing 654 FAIL DedicatedWorkerGlobalScope interface: self must inherit property "requestAnimationFrame(FrameRequestCallback)" with the proper type assert_own_property: expected property "requestAnimationFrame" missing 655 FAIL DedicatedWorkerGlobalScope interface: calling requestAnimationFrame(FrameRequestCallback) on self with too few arguments must throw TypeError assert_own_property: expected property "requestAnimationFrame" missing 656 FAIL DedicatedWorkerGlobalScope interface: self must inherit property "cancelAnimationFrame(unsigned long)" with the proper type assert_own_property: expected property "cancelAnimationFrame" missing 657 FAIL DedicatedWorkerGlobalScope interface: calling cancelAnimationFrame(unsigned long) on self with too few arguments must throw TypeError assert_own_property: expected property "cancelAnimationFrame" missing 654 PASS DedicatedWorkerGlobalScope interface: self must inherit property "requestAnimationFrame(FrameRequestCallback)" with the proper type 655 PASS DedicatedWorkerGlobalScope interface: calling requestAnimationFrame(FrameRequestCallback) on self with too few arguments must throw TypeError 656 PASS DedicatedWorkerGlobalScope interface: self must inherit property "cancelAnimationFrame(unsigned long)" with the proper type 657 PASS DedicatedWorkerGlobalScope interface: calling cancelAnimationFrame(unsigned long) on self with too few arguments must throw TypeError 658 658 PASS WorkerGlobalScope interface: self must inherit property "self" with the proper type 659 659 PASS WorkerGlobalScope interface: self must inherit property "location" with the proper type -
trunk/Source/WebCore/ChangeLog
r259296 r259298 1 2020-03-31 Chris Lord <clord@igalia.com> 2 3 requestAnimationFrame and cancelAnimationFrame should be present on DedicatedWorkerGlobalScope 4 https://bugs.webkit.org/show_bug.cgi?id=202525 5 6 Reviewed by Simon Fraser. 7 8 Implement AnimationFrameProvider on DedicatedWorkerGlobalScope, 9 This allows use of requestAnimationFrame and cancelAnimationFrame 10 inside a dedicated worker thread. This is useful to control animation 11 when using OffscreenCanvas, and this implementation is only enabled 12 with the OffscreenCanvas build flag and runtime setting. 13 Specification: https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#animation-frames 14 15 No new tests. Covered by existing tests. 16 17 * Headers.cmake: 18 * Sources.txt: 19 * WebCore.xcodeproj/project.pbxproj: 20 * bindings/js/WebCoreBuiltinNames.h: 21 * dom/RequestAnimationFrameCallback.h: 22 * workers/DedicatedWorkerGlobalScope.cpp: 23 (WebCore::DedicatedWorkerGlobalScope::requestAnimationFrame): 24 (WebCore::DedicatedWorkerGlobalScope::cancelAnimationFrame): 25 * workers/DedicatedWorkerGlobalScope.h: 26 * workers/DedicatedWorkerGlobalScope.idl: 27 * workers/WorkerAnimationController.cpp: Added. 28 * workers/WorkerAnimationController.h: Added. 29 * workers/WorkerGlobalScope.cpp: 30 (WebCore::WorkerGlobalScope::WorkerGlobalScope): 31 * workers/WorkerGlobalScope.h: 32 (WebCore::WorkerGlobalScope::requestAnimationFrameEnabled const): 33 * workers/WorkerMessagingProxy.cpp: 34 (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): 35 * workers/WorkerThread.cpp: 36 (WebCore::WorkerParameters::isolatedCopy const): 37 * workers/WorkerThread.h: 38 * workers/service/context/ServiceWorkerThread.cpp: 39 (WebCore::ServiceWorkerThread::ServiceWorkerThread): 40 1 41 2020-03-31 Zalan Bujtas <zalan@apple.com> 2 42 -
trunk/Source/WebCore/Headers.cmake
r259200 r259298 1487 1487 testing/MockGamepadProvider.h 1488 1488 1489 workers/WorkerAnimationController.h 1489 1490 workers/WorkerDebuggerProxy.h 1490 1491 workers/WorkerLoaderProxy.h -
trunk/Source/WebCore/Sources.txt
r259200 r259298 2569 2569 workers/DedicatedWorkerThread.cpp 2570 2570 workers/Worker.cpp 2571 workers/WorkerAnimationController.cpp 2571 2572 workers/WorkerConsoleClient.cpp 2572 2573 workers/WorkerEventLoop.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r259200 r259298 3118 3118 A454424F119B3687009BE912 /* RenderMeter.h in Headers */ = {isa = PBXBuildFile; fileRef = A454424D119B3687009BE912 /* RenderMeter.h */; }; 3119 3119 A456FA2711AD4A830020B420 /* LabelsNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = A456FA2511AD4A830020B420 /* LabelsNodeList.h */; }; 3120 A45734CF1D3AFD590190608F /* WorkerAnimationController.h in Headers */ = {isa = PBXBuildFile; fileRef = A45733CF1D3AFD590190608F /* WorkerAnimationController.h */; }; 3120 3121 A501920E132EBF2E008BFE55 /* Autocapitalize.h in Headers */ = {isa = PBXBuildFile; fileRef = A501920C132EBF2E008BFE55 /* Autocapitalize.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3121 3122 A5071E851C56D0DC009951BE /* ResourceUsageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A5071E821C56D079009951BE /* ResourceUsageData.h */; }; … … 11710 11711 A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LabelsNodeList.cpp; sourceTree = "<group>"; }; 11711 11712 A456FA2511AD4A830020B420 /* LabelsNodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LabelsNodeList.h; sourceTree = "<group>"; }; 11713 A45732CF1C3AFD590180608F /* WorkerAnimationController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerAnimationController.cpp; sourceTree = "<group>"; }; 11714 A45733CF1D3AFD590190608F /* WorkerAnimationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerAnimationController.h; sourceTree = "<group>"; }; 11712 11715 A4A69B8BB91B49D0A804C31D /* JSPromiseRejectionEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPromiseRejectionEventCustom.cpp; sourceTree = "<group>"; }; 11713 11716 A501920C132EBF2E008BFE55 /* Autocapitalize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Autocapitalize.h; sourceTree = "<group>"; }; … … 18102 18105 2E4346340F546A8200B0F1BA /* Worker.h */, 18103 18106 2E4346350F546A8200B0F1BA /* Worker.idl */, 18107 A45732CF1C3AFD590180608F /* WorkerAnimationController.cpp */, 18108 A45733CF1D3AFD590190608F /* WorkerAnimationController.h */, 18104 18109 A55639CF1C6EFD5900806D8E /* WorkerConsoleClient.cpp */, 18105 18110 A55639D01C6EFD5900806D8E /* WorkerConsoleClient.h */, … … 33486 33491 379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */, 33487 33492 2E4346460F546A8200B0F1BA /* Worker.h in Headers */, 33493 A45734CF1D3AFD590190608F /* WorkerAnimationController.h in Headers */, 33488 33494 91278D6221DEDAF000B57184 /* WorkerAuditAgent.h in Headers */, 33489 33495 41A7D3531F438D16008988DE /* WorkerCacheStorageConnection.h in Headers */, -
trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h
r258498 r259298 265 265 macro(caches) \ 266 266 macro(cancel) \ 267 macro(cancelAnimationFrame) \ 267 268 macro(cancelIdleCallback) \ 268 269 macro(cloneArrayBuffer) \ … … 340 341 macro(reader) \ 341 342 macro(readyPromiseCapability) \ 343 macro(requestAnimationFrame) \ 342 344 macro(requestIdleCallback) \ 343 345 macro(response) \ -
trunk/Source/WebCore/dom/RequestAnimationFrameCallback.h
r243810 r259298 33 33 #include "ActiveDOMCallback.h" 34 34 #include "CallbackResult.h" 35 #include "DOMHighResTimeStamp.h" 35 36 #include <wtf/RefCounted.h> 37 #include <wtf/Seconds.h> 36 38 37 39 namespace WebCore { … … 45 47 int m_id; 46 48 bool m_firedOrCancelled; 49 50 // Allow a little more than 60fps to make sure we can at least hit that frame rate. 51 static constexpr Seconds fullSpeedAnimationInterval { 15_ms }; 52 // Allow a little more than 30fps to make sure we can at least hit that frame rate. 53 static constexpr Seconds halfSpeedThrottlingAnimationInterval { 30_ms }; 54 static constexpr Seconds aggressiveThrottlingAnimationInterval { 10_s }; 47 55 }; 48 56 -
trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
r256012 r259298 37 37 #include "DedicatedWorkerThread.h" 38 38 #include "MessageEvent.h" 39 #include "RequestAnimationFrameCallback.h" 39 40 #include "SecurityOrigin.h" 41 #if ENABLE(OFFSCREEN_CANVAS) 42 #include "WorkerAnimationController.h" 43 #endif 40 44 #include "WorkerObjectProxy.h" 41 45 #include <wtf/IsoMallocInlines.h> … … 94 98 } 95 99 100 #if ENABLE(OFFSCREEN_CANVAS) 101 CallbackId DedicatedWorkerGlobalScope::requestAnimationFrame(Ref<RequestAnimationFrameCallback>&& callback) 102 { 103 if (!m_workerAnimationController) 104 m_workerAnimationController = WorkerAnimationController::create(*this); 105 return m_workerAnimationController->requestAnimationFrame(WTFMove(callback)); 106 } 107 108 void DedicatedWorkerGlobalScope::cancelAnimationFrame(CallbackId callbackId) 109 { 110 if (m_workerAnimationController) 111 m_workerAnimationController->cancelAnimationFrame(callbackId); 112 } 113 #endif 114 96 115 } // namespace WebCore -
trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h
r256012 r259298 46 46 class DedicatedWorkerThread; 47 47 class MessagePort; 48 class RequestAnimationFrameCallback; 48 49 class SerializedScriptValue; 50 51 #if ENABLE(OFFSCREEN_CANVAS) 52 class WorkerAnimationController; 53 54 using CallbackId = int; 55 #endif 49 56 50 57 class DedicatedWorkerGlobalScope final : public WorkerGlobalScope { … … 60 67 DedicatedWorkerThread& thread(); 61 68 69 #if ENABLE(OFFSCREEN_CANVAS) 70 CallbackId requestAnimationFrame(Ref<RequestAnimationFrameCallback>&&); 71 void cancelAnimationFrame(CallbackId); 72 #endif 73 62 74 private: 63 75 using Base = WorkerGlobalScope; … … 70 82 71 83 String m_name; 84 85 #if ENABLE(OFFSCREEN_CANVAS) 86 RefPtr<WorkerAnimationController> m_workerAnimationController; 87 #endif 72 88 }; 73 89 -
trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl
r253497 r259298 43 43 [CallWith=GlobalObject, MayThrowException] void postMessage(any message, optional PostMessageOptions options); 44 44 45 [Conditional=OFFSCREEN_CANVAS, EnabledAtRuntime=OffscreenCanvas] long requestAnimationFrame(RequestAnimationFrameCallback callback); // FIXME: Should return an unsigned long. 46 [Conditional=OFFSCREEN_CANVAS, EnabledAtRuntime=OffscreenCanvas] void cancelAnimationFrame(long handle); // FIXME: handle should be an unsigned long. 47 45 48 void close(); 46 49 -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r256012 r259298 79 79 , m_performance(Performance::create(this, params.timeOrigin)) 80 80 , m_referrerPolicy(params.referrerPolicy) 81 , m_requestAnimationFrameEnabled(params.requestAnimationFrameEnabled) 81 82 { 82 83 #if !ENABLE(INDEXED_DATABASE) -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r256012 r259298 142 142 ReferrerPolicy referrerPolicy() const final; 143 143 144 bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; } 145 144 146 protected: 145 147 WorkerGlobalScope(const WorkerParameters&, Ref<SecurityOrigin>&&, WorkerThread&, Ref<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*); … … 221 223 std::unique_ptr<CSSValuePool> m_cssValuePool; 222 224 ReferrerPolicy m_referrerPolicy; 225 bool m_requestAnimationFrameEnabled; 223 226 }; 224 227 -
trunk/Source/WebCore/workers/WorkerMessagingProxy.cpp
r256012 r259298 40 40 #include "Page.h" 41 41 #include "ScriptExecutionContext.h" 42 #include "Settings.h" 42 43 #include "Worker.h" 43 44 #include "WorkerInspectorProxy.h" … … 89 90 SocketProvider* socketProvider = document.socketProvider(); 90 91 91 WorkerParameters params = { scriptURL, name, identifier, userAgent, isOnline, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, timeOrigin, referrerPolicy };92 WorkerParameters params = { scriptURL, name, identifier, userAgent, isOnline, contentSecurityPolicyResponseHeaders, shouldBypassMainWorldContentSecurityPolicy, timeOrigin, referrerPolicy, document.settings().requestAnimationFrameEnabled() }; 92 93 auto thread = DedicatedWorkerThread::create(params, sourceCode, *this, *this, *this, startMode, document.topOrigin(), proxy, socketProvider, runtimeFlags); 93 94 -
trunk/Source/WebCore/workers/WorkerThread.cpp
r257521 r259298 82 82 timeOrigin, 83 83 referrerPolicy, 84 requestAnimationFrameEnabled, 84 85 }; 85 86 } -
trunk/Source/WebCore/workers/WorkerThread.h
r256012 r259298 69 69 MonotonicTime timeOrigin; 70 70 ReferrerPolicy referrerPolicy; 71 bool requestAnimationFrameEnabled; 71 72 72 73 WorkerParameters isolatedCopy() const; -
trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
r256012 r259298 74 74 75 75 ServiceWorkerThread::ServiceWorkerThread(const ServiceWorkerContextData& data, String&& userAgent, WorkerLoaderProxy& loaderProxy, WorkerDebuggerProxy& debuggerProxy, IDBClient::IDBConnectionProxy* idbConnectionProxy, SocketProvider* socketProvider) 76 : WorkerThread({ data.scriptURL, emptyString(), "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), WTFMove(userAgent), platformStrategies()->loaderStrategy()->isOnLine(), data.contentSecurityPolicy, false, MonotonicTime::now(), { } }, data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, data.registration.key.topOrigin().securityOrigin().get(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled())76 : WorkerThread({ data.scriptURL, emptyString(), "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), WTFMove(userAgent), platformStrategies()->loaderStrategy()->isOnLine(), data.contentSecurityPolicy, false, MonotonicTime::now(), { }, true }, data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, data.registration.key.topOrigin().securityOrigin().get(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled()) 77 77 , m_data(data.isolatedCopy()) 78 78 , m_workerObjectProxy(DummyServiceWorkerThreadProxy::shared())
Note:
See TracChangeset
for help on using the changeset viewer.