[WebGPU] Move 'gpu' API entry point from DOMWindow to Navigator
authorjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Apr 2019 16:33:35 +0000 (16:33 +0000)
committerjustin_fan@apple.com <justin_fan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Apr 2019 16:33:35 +0000 (16:33 +0000)
commit4f0e81892052000889862a3199c94974dccde096
tree0cba19af1c069ba2e9bccc1db92efdccb930d666
parent60c15e58c13f89cde19800cf31ce1ad58194fce4
[WebGPU] Move 'gpu' API entry point from DOMWindow to Navigator
https://bugs.webkit.org/show_bug.cgi?id=197348

Reviewed by Myles C. Maxfield.

Source/WebCore:

Latest API provides 'gpu' through Navigator instead of DOMWindow. Replace DOMWindowWebGPU with NavigatorGPU.

Existing tests updated to match. Add test: webgpu-enabled-in-worker.html to ensure workers can access WebGPU.

* CMakeLists.txt:
* DerivedSources.make:
* Modules/webgpu/NavigatorGPU.cpp:
(WebCore::NavigatorGPU::from):
(WebCore::NavigatorGPU::supplementName):
(WebCore::NavigatorGPU::gpu):
(WebCore::NavigatorGPU::gpu const):
* Modules/webgpu/NavigatorGPU.h:
* Modules/webgpu/NavigatorGPU.idl:
* Modules/webgpu/WorkerNavigatorGPU.cpp:
(WebCore::WorkerNavigatorGPU::from):
(WebCore::WorkerNavigatorGPU::supplementName):
(WebCore::WorkerNavigatorGPU::gpu):
(WebCore::WorkerNavigatorGPU::gpu const):
* Modules/webgpu/WorkerNavigatorGPU.h:
* Modules/webgpu/WorkerNavigatorGPU.idl:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:

LayoutTests:

WebGPU is now accessed through navigator.gpu instead of window.gpu.
Add webgpu-enabled-in-worker to ensure workers can access WebGPU.

* webgpu/adapter-options.html:
* webgpu/js/create-worker-device.js: Added.
(async.tryCreateDevice):
* webgpu/js/webgpu-functions.js:
(async.getBasicDevice):
* webgpu/queue-creation.html:
* webgpu/webgpu-enabled-in-worker-expected.txt: Added.
* webgpu/webgpu-enabled-in-worker.html: Added.
* webgpu/webgpu-enabled.html:
* webgpu/whlsl.html:

Add navigator.gpu to expectations for navigator-detached-no-crash.
* fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244777 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt
LayoutTests/platform/mac-highsierra/fast/dom/navigator-detached-no-crash-expected.txt
LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
LayoutTests/webgpu/adapter-options.html
LayoutTests/webgpu/js/create-worker-device.js [new file with mode: 0644]
LayoutTests/webgpu/js/webgpu-functions.js
LayoutTests/webgpu/queue-creation.html
LayoutTests/webgpu/webgpu-enabled-in-worker-expected.txt [new file with mode: 0644]
LayoutTests/webgpu/webgpu-enabled-in-worker.html [new file with mode: 0644]
LayoutTests/webgpu/webgpu-enabled.html
LayoutTests/webgpu/whlsl.html
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/DerivedSources.make
Source/WebCore/Modules/webgpu/NavigatorGPU.cpp [moved from Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp with 71% similarity]
Source/WebCore/Modules/webgpu/NavigatorGPU.h [moved from Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h with 83% similarity]
Source/WebCore/Modules/webgpu/NavigatorGPU.idl [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WorkerNavigatorGPU.cpp [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WorkerNavigatorGPU.h [new file with mode: 0644]
Source/WebCore/Modules/webgpu/WorkerNavigatorGPU.idl [moved from Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl with 89% similarity]
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj