WebKit Bugzilla
Attachment 368482 Details for
Bug 197348
: [WebGPU] Move 'gpu' API entry point from DOMWindow to Navigator
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197348-20190429132759.patch (text/plain), 31.01 KB, created by
Justin Fan
on 2019-04-29 13:28:00 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Justin Fan
Created:
2019-04-29 13:28:00 PDT
Size:
31.01 KB
patch
obsolete
>Subversion Revision: 244708 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9964d1ee8c23af6a8d7a9eb130f635df5008fd63..5473da116d4668d15cba88ddcaef109965229605 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,30 @@ >+2019-04-27 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Move 'gpu' API entry point from DOMWindow to Navigator >+ https://bugs.webkit.org/show_bug.cgi?id=197348 >+ >+ Latest API provides 'gpu' through Navigator instead of DOMWindow. Replace DOMWindowWebGPU with NavigatorGPU. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Existing tests updated to match. >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * DOMWindowWebGPU.cpp: Removed. >+ * DOMWindowWebGPU.h: Removed. >+ * DOMWindowWebGPU.idl: Removed. >+ * Modules/webgpu/NavigatorGPU.cpp: Added. >+ (WebCore::NavigatorGPU::from): >+ (WebCore::NavigatorGPU::supplementName): >+ (WebCore::NavigatorGPU::gpu): >+ (WebCore::NavigatorGPU::gpu const): >+ * Modules/webgpu/NavigatorGPU.h: Added. >+ * Modules/webgpu/NavigatorGPU.idl: Added. >+ * Modules/webgpu/WebGPUComputePassEncoder.cpp: Missing include. >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ > 2019-04-26 Robin Morisset <rmorisset@apple.com> > > All prototypes should call didBecomePrototype() >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 2a83ee00e8f3af711135cf7476907ba666eec553..c282677a8f90added0ebbf6a75e6abfbe0cb21f2 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -468,7 +468,6 @@ set(WebCore_NON_SVG_IDL_FILES > > Modules/webdriver/NavigatorWebDriver.idl > >- Modules/webgpu/DOMWindowWebGPU.idl > Modules/webgpu/GPUBindGroupLayoutBinding.idl > Modules/webgpu/GPUBindGroupLayoutDescriptor.idl > Modules/webgpu/GPUBlendDescriptor.idl >@@ -493,6 +492,7 @@ set(WebCore_NON_SVG_IDL_FILES > Modules/webgpu/GPUTextureUsage.idl > Modules/webgpu/GPUVertexAttributeDescriptor.idl > Modules/webgpu/GPUVertexInputDescriptor.idl >+ Modules/webgpu/NavigatorGPU.idl > Modules/webgpu/WebGPU.idl > Modules/webgpu/WebGPUAdapter.idl > Modules/webgpu/WebGPUBindGroup.idl >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 8e1009fbe77f4b3736b4b7850bdafb1121cd6b87..88bc111ba8316334da55ab4827542b3e4aa54c25 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -374,7 +374,6 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webdatabase/SQLTransactionCallback.idl \ > $(WebCore)/Modules/webdatabase/SQLTransactionErrorCallback.idl \ > $(WebCore)/Modules/webdriver/NavigatorWebDriver.idl \ >- $(WebCore)/Modules/webgpu/DOMWindowWebGPU.idl \ > $(WebCore)/Modules/webgpu/GPUCanvasContext.idl \ > $(WebCore)/Modules/webgpu/GPUColor.idl \ > $(WebCore)/Modules/webgpu/GPUColorStateDescriptor.idl \ >@@ -399,6 +398,7 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webgpu/GPUTextureUsage.idl \ > $(WebCore)/Modules/webgpu/GPUVertexAttributeDescriptor.idl \ > $(WebCore)/Modules/webgpu/GPUVertexInputDescriptor.idl \ >+ $(WebCore)/Modules/webgpu/NavigatorGPU.idl \ > $(WebCore)/Modules/webgpu/WebGPU.idl \ > $(WebCore)/Modules/webgpu/WebGPUAdapter.idl \ > $(WebCore)/Modules/webgpu/WebGPUBindGroup.idl \ >diff --git a/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp b/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp >deleted file mode 100644 >index 825f733c3e44cc02a7806ea58519d64bd9afbd74..0000000000000000000000000000000000000000 >--- a/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.cpp >+++ /dev/null >@@ -1,74 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple 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. 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 INC. 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. >- */ >- >-#include "config.h" >-#include "DOMWindowWebGPU.h" >- >-#if ENABLE(WEBGPU) >- >-#include "DOMWindow.h" >-#include "RuntimeEnabledFeatures.h" >-#include "WebGPU.h" >- >-namespace WebCore { >- >-DOMWindowWebGPU::DOMWindowWebGPU(DOMWindow* window) >- : DOMWindowProperty(window) >-{ >-} >- >-const char* DOMWindowWebGPU::supplementName() >-{ >- return "DOMWindowWebGPU"; >-} >- >-DOMWindowWebGPU* DOMWindowWebGPU::from(DOMWindow* window) >-{ >- DOMWindowWebGPU* supplement = static_cast<DOMWindowWebGPU*>(Supplement<DOMWindow>::from(window, supplementName())); >- if (!supplement) { >- auto newSupplement = std::make_unique<DOMWindowWebGPU>(window); >- supplement = newSupplement.get(); >- provideTo(window, supplementName(), WTFMove(newSupplement)); >- } >- return supplement; >-} >- >-WebGPU* DOMWindowWebGPU::gpu(DOMWindow& window) >-{ >- return DOMWindowWebGPU::from(&window)->gpu(); >-} >- >-WebGPU* DOMWindowWebGPU::gpu() const >-{ >- ASSERT(RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled()); >- >- if (!m_gpu && frame()) >- m_gpu = WebGPU::create(); >- return m_gpu.get(); >-} >- >-} // namespace WebCore >- >-#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h b/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h >deleted file mode 100644 >index a8b5bd3d8ea6434de50592718e22d304b1f73015..0000000000000000000000000000000000000000 >--- a/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.h >+++ /dev/null >@@ -1,55 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple 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. 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 INC. 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. >- */ >- >-#pragma once >- >-#if ENABLE(WEBGPU) >- >-#include "DOMWindowProperty.h" >-#include "Supplementable.h" >- >-namespace WebCore { >- >-class DOMWindow; >-class WebGPU; >- >-class DOMWindowWebGPU : public Supplement<DOMWindow>, public DOMWindowProperty { >- WTF_MAKE_FAST_ALLOCATED; >-public: >- explicit DOMWindowWebGPU(DOMWindow*); >- virtual ~DOMWindowWebGPU() = default; >- static DOMWindowWebGPU* from(DOMWindow*); >- static WebGPU* gpu(DOMWindow&); >- WebGPU* gpu() const; >- >-private: >- static const char* supplementName(); >- >- mutable RefPtr<WebGPU> m_gpu; >-}; >- >-} // namespace WebCore >- >-#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl b/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl >deleted file mode 100644 >index b06a8b3116f6b92fc384cf23164f91c356fb08e9..0000000000000000000000000000000000000000 >--- a/Source/WebCore/Modules/webgpu/DOMWindowWebGPU.idl >+++ /dev/null >@@ -1,32 +0,0 @@ >-/* >- * Copyright (C) 2018 Apple 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. 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 INC. 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. >- */ >-// https://github.com/gpuweb/gpuweb/blob/master/design/sketch.webidl >- >-[ >- Conditional=WEBGPU, >- EnabledAtRuntime=WebGPU >-] partial interface DOMWindow { >- [Replaceable, SameObject] readonly attribute WebGPU gpu; >-}; >diff --git a/Source/WebCore/Modules/webgpu/NavigatorGPU.cpp b/Source/WebCore/Modules/webgpu/NavigatorGPU.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..88a978044bc1e708933565dc62d0a3146b38b426 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/NavigatorGPU.cpp >@@ -0,0 +1,69 @@ >+/* >+ * Copyright (C) 2018 Apple 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. 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 INC. 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. >+ */ >+ >+#include "config.h" >+#include "NavigatorGPU.h" >+ >+#if ENABLE(WEBGPU) >+ >+#include "Navigator.h" >+#include "RuntimeEnabledFeatures.h" >+#include "WebGPU.h" >+ >+namespace WebCore { >+ >+NavigatorGPU* NavigatorGPU::from(Navigator* navigator) >+{ >+ NavigatorGPU* supplement = static_cast<NavigatorGPU*>(Supplement<Navigator>::from(navigator, supplementName())); >+ if (!supplement) { >+ auto newSupplement = std::make_unique<NavigatorGPU>(); >+ supplement = newSupplement.get(); >+ provideTo(navigator, supplementName(), WTFMove(newSupplement)); >+ } >+ return supplement; >+} >+ >+const char* NavigatorGPU::supplementName() >+{ >+ return "NavigatorGPU"; >+} >+ >+const WebGPU* NavigatorGPU::gpu(Navigator& navigator) >+{ >+ return NavigatorGPU::from(&navigator)->gpu(); >+} >+ >+const WebGPU* NavigatorGPU::gpu() const >+{ >+ ASSERT(RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled()); >+ >+ if (!m_gpu) >+ m_gpu = WebGPU::create(); >+ return m_gpu.get(); >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/NavigatorGPU.h b/Source/WebCore/Modules/webgpu/NavigatorGPU.h >new file mode 100644 >index 0000000000000000000000000000000000000000..7758d0846cd6729f48ee95e7723b9fdb91f48b79 >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/NavigatorGPU.h >@@ -0,0 +1,53 @@ >+/* >+ * Copyright (C) 2018 Apple 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. 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 INC. 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. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBGPU) >+ >+#include "Supplementable.h" >+ >+namespace WebCore { >+ >+class Navigator; >+class WebGPU; >+ >+class NavigatorGPU final : public Supplement<Navigator> { >+ WTF_MAKE_FAST_ALLOCATED; >+public: >+ static const WebGPU* gpu(Navigator&); >+ >+private: >+ static NavigatorGPU* from(Navigator*); >+ static const char* supplementName(); >+ >+ const WebGPU* gpu() const; >+ >+ mutable RefPtr<WebGPU> m_gpu; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBGPU) >diff --git a/Source/WebCore/Modules/webgpu/NavigatorGPU.idl b/Source/WebCore/Modules/webgpu/NavigatorGPU.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..fc2ede1c84e4bcc0d005bc2333686b116e3cbf6c >--- /dev/null >+++ b/Source/WebCore/Modules/webgpu/NavigatorGPU.idl >@@ -0,0 +1,33 @@ >+/* >+ * Copyright (C) 2018 Apple 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. 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 INC. 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. >+ */ >+// https://github.com/gpuweb/gpuweb/blob/master/spec/index.bs >+ >+[ >+ Conditional=WEBGPU, >+ EnabledAtRuntime=WebGPU, >+ Exposed=Window >+] partial interface Navigator { >+ [SameObject] readonly attribute WebGPU gpu; >+}; >diff --git a/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp b/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp >index 770d1a1b14d4c20c41461283e6c241d59185d6cf..acfa788c86bc91b8b073a6d5b3d5515772723cce 100644 >--- a/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp >+++ b/Source/WebCore/Modules/webgpu/WebGPUComputePassEncoder.cpp >@@ -30,6 +30,7 @@ > > #include "GPUComputePassEncoder.h" > #include "GPUProgrammablePassEncoder.h" >+#include "Logging.h" > #include "WebGPUComputePipeline.h" > > namespace WebCore { >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 3606acbf1dfefbb604b084157128c3271ee9d679..53f88459fad455c6392d22b53502107914b9ce7b 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -304,8 +304,8 @@ Modules/websockets/WebSocketFrame.cpp > Modules/websockets/WebSocketHandshake.cpp > Modules/websockets/WorkerThreadableWebSocketChannel.cpp > >-Modules/webgpu/DOMWindowWebGPU.cpp > Modules/webgpu/GPUCanvasContext.cpp >+Modules/webgpu/NavigatorGPU.cpp > Modules/webgpu/WHLSL/WHLSLInferTypes.cpp > Modules/webgpu/WHLSL/WHLSLLexer.cpp > Modules/webgpu/WHLSL/WHLSLParser.cpp >@@ -2655,7 +2655,6 @@ JSDOMWindowFetch.cpp > JSDOMWindowIndexedDatabase.cpp > JSDOMWindowSpeechSynthesis.cpp > JSDOMWindowWebDatabase.cpp >-JSDOMWindowWebGPU.cpp > JSDOMWindowWebVR.cpp > JSDataTransfer.cpp > JSDataTransferItem.cpp >@@ -2918,6 +2917,7 @@ JSNavigator.cpp > JSNavigatorBeacon.cpp > JSNavigatorCredentials.cpp > JSNavigatorGeolocation.cpp >+JSNavigatorGPU.cpp > JSNavigatorID.cpp > JSNavigatorLanguage.cpp > JSNavigatorMediaCapabilities.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index d717275a8b79aaa462797c96125a5b87ddf62554..ece9541364ad67dc5a5bc6ab485e4561fe7881bb 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -100,7 +100,6 @@ > 0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */ = {isa = PBXBuildFile; fileRef = 0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */; }; > 070E09191875EEFC003A1D3C /* PlatformMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E09181875ED93003A1D3C /* PlatformMediaSession.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 070E81D11BF27656001FDA48 /* VideoTrackPrivateMediaStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 070E81D01BF27656001FDA48 /* VideoTrackPrivateMediaStream.h */; }; >- CDA79827170A279100D45C55 /* AudioSessionIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDA79825170A279000D45C55 /* AudioSessionIOS.mm */; }; > 070F549817F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 070F549717F12F6B00169E04 /* MediaStreamConstraintsValidationClient.h */; }; > 0719427F1D088F21002AA51D /* AVFoundationMIMETypeCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = 07C8AD111D073D630087C5CE /* AVFoundationMIMETypeCache.mm */; }; > 071A9EC2168FBC43002629F9 /* TextTrackCueGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */; }; >@@ -4080,6 +4079,7 @@ > CDA29A321CC01A9500901CCF /* PlaybackSessionInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA29A2E1CBF73FC00901CCF /* PlaybackSessionInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; }; > CDA595932146DEC300A84185 /* HEVCUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA595912146DEC300A84185 /* HEVCUtilities.h */; }; > CDA595982146DF7800A84185 /* HEVCUtilitiesCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA595962146DF7800A84185 /* HEVCUtilitiesCocoa.h */; }; >+ CDA79827170A279100D45C55 /* AudioSessionIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDA79825170A279000D45C55 /* AudioSessionIOS.mm */; }; > CDA7982A170A3D0000D45C55 /* AudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = CDA79821170A22DC00D45C55 /* AudioSession.h */; settings = {ATTRIBUTES = (Private, ); }; }; > CDA98E0B1603CD6000FEA3B1 /* LegacyCDM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDA98E091603CD5900FEA3B1 /* LegacyCDM.cpp */; }; > CDAB6D2917C7DE6C00C60B34 /* MediaControlsHost.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAB6D2717C7DE6C00C60B34 /* MediaControlsHost.h */; }; >@@ -13822,12 +13822,12 @@ > D003914122248D400098998C /* GPUProgrammablePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = GPUProgrammablePassEncoder.cpp; sourceTree = "<group>"; }; > D00487D222457BEA00EED7D9 /* WebGPUPipelineLayoutDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUPipelineLayoutDescriptor.cpp; sourceTree = "<group>"; }; > D00487E5226A634200EED7D9 /* WebGPUSwapChainDescriptor.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUSwapChainDescriptor.cpp; sourceTree = "<group>"; }; >+ D00487EB2274281200EED7D9 /* NavigatorGPU.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = NavigatorGPU.idl; sourceTree = "<group>"; }; >+ D00487ED2274281300EED7D9 /* NavigatorGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorGPU.cpp; sourceTree = "<group>"; }; >+ D00487EE2274281400EED7D9 /* NavigatorGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NavigatorGPU.h; sourceTree = "<group>"; }; > D00D77FD2242ED450043F12C /* WebGPUComputePassEncoder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPUComputePassEncoder.h; sourceTree = "<group>"; }; > D00D77FE2242ED450043F12C /* WebGPUComputePassEncoder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUComputePassEncoder.cpp; sourceTree = "<group>"; }; > D00D77FF2242ED450043F12C /* WebGPUComputePassEncoder.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPUComputePassEncoder.idl; sourceTree = "<group>"; }; >- D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DOMWindowWebGPU.h; sourceTree = "<group>"; }; >- D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowWebGPU.cpp; sourceTree = "<group>"; }; >- D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = DOMWindowWebGPU.idl; sourceTree = "<group>"; }; > D00F5946216EFE54000D71DB /* WebGPU.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebGPU.h; sourceTree = "<group>"; }; > D00F5947216EFE54000D71DB /* WebGPU.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPU.cpp; sourceTree = "<group>"; }; > D00F5948216EFE54000D71DB /* WebGPU.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebGPU.idl; sourceTree = "<group>"; }; >@@ -25756,9 +25756,6 @@ > isa = PBXGroup; > children = ( > C210E90D21B4BCA400B7F83D /* WHLSL */, >- D00F5941216ECC7A000D71DB /* DOMWindowWebGPU.cpp */, >- D00F5940216ECC7A000D71DB /* DOMWindowWebGPU.h */, >- D00F5942216ECC7A000D71DB /* DOMWindowWebGPU.idl */, > D0B8BB0121C46E78000C7681 /* GPUBindGroupLayoutBinding.h */, > D0D69C9F222E015E0032927E /* GPUBindGroupLayoutBinding.idl */, > D0D69C9C222E00C20032927E /* GPUBindGroupLayoutDescriptor.h */, >@@ -25789,6 +25786,9 @@ > D026F483220A472F00AC5F49 /* GPUTextureUsage.idl */, > D0D8649621BA18F4003C983C /* GPUVertexAttributeDescriptor.idl */, > D0D8649821BA19A7003C983C /* GPUVertexInputDescriptor.idl */, >+ D00487ED2274281300EED7D9 /* NavigatorGPU.cpp */, >+ D00487EE2274281400EED7D9 /* NavigatorGPU.h */, >+ D00487EB2274281200EED7D9 /* NavigatorGPU.idl */, > D00F5947216EFE54000D71DB /* WebGPU.cpp */, > D00F5946216EFE54000D71DB /* WebGPU.h */, > D00F5948216EFE54000D71DB /* WebGPU.idl */, >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 52b7b788d46ddc52093166a779abaf47d92a7e4c..4ee699d48cd25d9cfc387ff4f9f98737abd2a219 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,20 @@ >+2019-04-27 Justin Fan <justin_fan@apple.com> >+ >+ [WebGPU] Move 'gpu' API entry point from DOMWindow to Navigator >+ https://bugs.webkit.org/show_bug.cgi?id=197348 >+ >+ WebGPU is now accessed through navigator.gpu instead of window.gpu. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/dom/navigator-detached-no-crash-expected.txt: Add navigator.gpu to expected output. >+ * webgpu/adapter-options.html: >+ * webgpu/js/webgpu-functions.js: >+ (async.getBasicDevice): >+ * webgpu/queue-creation.html: >+ * webgpu/webgpu-enabled.html: >+ * webgpu/whlsl.html: >+ > 2019-04-26 Youenn Fablet <youenn@apple.com> > > Use normal loading path for ping loads >diff --git a/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt b/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt >index 6c99ccb0d0a53ecba2df73034805ce1488d69468..924b3294dc3bcf3f291f85a83adf245331f15c59 100644 >--- a/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt >+++ b/LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt >@@ -8,6 +8,7 @@ navigator.appVersion is OK > navigator.cookieEnabled is OK > navigator.credentials is OK > navigator.getStorageUpdates() is OK >+navigator.gpu is OK > navigator.javaEnabled() is OK > navigator.language is OK > navigator.languages is OK >@@ -32,6 +33,7 @@ navigator.appVersion is OK > navigator.cookieEnabled is OK > navigator.credentials is OK > navigator.getStorageUpdates() is OK >+navigator.gpu is OK > navigator.javaEnabled() is OK > navigator.language is OK > navigator.languages is OK >diff --git a/LayoutTests/webgpu/adapter-options.html b/LayoutTests/webgpu/adapter-options.html >index 986cce1432deaede54b2756683f17174c807cfd8..9f5187a42eb649da05cfda49e9a8c8cf44a67de9 100644 >--- a/LayoutTests/webgpu/adapter-options.html >+++ b/LayoutTests/webgpu/adapter-options.html >@@ -6,21 +6,21 @@ > <script src="../resources/testharnessreport.js"></script> > <script> > promise_test(async () => { >- const defaultAdapter = await gpu.requestAdapter(); >+ const defaultAdapter = await navigator.gpu.requestAdapter(); > const device = await defaultAdapter.requestDevice(); > > assert_true(device instanceof WebGPUDevice, "Default device successfully created."); > }, "Create the default device."); > > promise_test(async () => { >- const lowPowerAdapter = await gpu.requestAdapter({ powerPreference: "low-power" }); >+ const lowPowerAdapter = await navigator.gpu.requestAdapter({ powerPreference: "low-power" }); > const device = await lowPowerAdapter.requestDevice(); > > assert_true(device instanceof WebGPUDevice, "Device successfully created using low-power option."); > }, "Create a device with a low-power option."); > > promise_test(async () => { >- const highPerfAdapter = await gpu.requestAdapter({ powerPreference: "high-performance" }); >+ const highPerfAdapter = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" }); > const device = await highPerfAdapter.requestDevice(); > > assert_true(device instanceof WebGPUDevice, "Device successfully created using high-performance option."); >diff --git a/LayoutTests/webgpu/js/webgpu-functions.js b/LayoutTests/webgpu/js/webgpu-functions.js >index a64937b2b9c9fb7e6e2e0bd700765802ea0b4738..270876b1a897f393ea9ef7fd68507e71ba1b7c8f 100644 >--- a/LayoutTests/webgpu/js/webgpu-functions.js >+++ b/LayoutTests/webgpu/js/webgpu-functions.js >@@ -1,5 +1,5 @@ > async function getBasicDevice() { >- const adapter = await gpu.requestAdapter({ powerPreference: "low-power" }); >+ const adapter = await navigator.gpu.requestAdapter({ powerPreference: "low-power" }); > const device = await adapter.requestDevice(); > return device; > } >diff --git a/LayoutTests/webgpu/queue-creation.html b/LayoutTests/webgpu/queue-creation.html >index db43da50b61fb10531999fb8e2068d656a76bbbc..6bd18e1c855e17b02d2de639d548385271dc10fe 100644 >--- a/LayoutTests/webgpu/queue-creation.html >+++ b/LayoutTests/webgpu/queue-creation.html >@@ -9,12 +9,12 @@ > 'use strict'; > > promise_test(async t => { >- assert_not_equals(window.gpu, undefined, "window.gpu exists"); >+ assert_not_equals(navigator.gpu, undefined, "navigator.gpu exists"); > > const context = document.createElement("canvas").getContext("gpu"); > assert_true(context instanceof GPUCanvasContext, "getContext returned a GPUCanvasContext."); > >- const adapter = await window.gpu.requestAdapter({}); >+ const adapter = await navigator.gpu.requestAdapter({}); > assert_true(adapter instanceof WebGPUAdapter, "requestAdapter returned a WebGPUAdapter."); > > const device = await adapter.requestDevice(); >diff --git a/LayoutTests/webgpu/webgpu-enabled.html b/LayoutTests/webgpu/webgpu-enabled.html >index 76d6c38d495a18b3426cada440d75a7dead29214..537350bdc15ec0e152f96f907417c3e91ff0c39d 100644 >--- a/LayoutTests/webgpu/webgpu-enabled.html >+++ b/LayoutTests/webgpu/webgpu-enabled.html >@@ -10,9 +10,10 @@ promise_test(async () => { > const context = canvas.getContext("gpu"); > assert_true(context instanceof GPUCanvasContext, "Created GPUCanvasContext."); > >- assert_not_equals(window.gpu, undefined, "window.gpu is defined."); >+ assert_equals(window.gpu, undefined, "window.gpu should not be defined.") >+ assert_not_equals(navigator.gpu, undefined, "navigator.gpu is defined."); > >- const adapter = await window.gpu.requestAdapter(); >+ const adapter = await navigator.gpu.requestAdapter(); > assert_true(adapter instanceof WebGPUAdapter, "Created default GPUAdapter."); > > const device = await adapter.requestDevice(); >diff --git a/LayoutTests/webgpu/whlsl.html b/LayoutTests/webgpu/whlsl.html >index 47aa51846d57685132f717219d5523ad62a1040a..7c7d79e50f8ae4920f53d11bb91ca67ba0255a11 100644 >--- a/LayoutTests/webgpu/whlsl.html >+++ b/LayoutTests/webgpu/whlsl.html >@@ -15,7 +15,7 @@ fragment float4 fragmentShader(float4 position : SV_Position) : SV_Target 0 { > } > `; > async function start() { >- const adapter = await window.gpu.requestAdapter(); >+ const adapter = await navigator.gpu.requestAdapter(); > const device = await adapter.requestDevice(); > > const shaderModule = device.createShaderModule({code: shaderSource, isWHLSL: true});
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 197348
:
368417
|
368418
|
368419
|
368482
|
368484
|
368492
|
368503
|
368528