Title: [234564] trunk/Source/WebCore
Revision
234564
Author
[email protected]
Date
2018-08-03 16:25:56 -0700 (Fri, 03 Aug 2018)

Log Message

Remove WebGPUObject
https://bugs.webkit.org/show_bug.cgi?id=188114

Patch by Sam Weinig <[email protected]> on 2018-08-03
Reviewed by Darin Adler.

This removes the unecessary WebGPUObject base class and updates the classes
that were inheriting from it to instead inherit directly from RefCounted. This
shrinks the size of all the classes that were inheriting from it, as they no
longer store a RefPtr<WebGPURenderingContext> member, which is unused. Most
of the classes also shrink because they can be devirtualized.

This also updates most of the create functions and constructors for the classes
that were inheriting from WebGPUObject to no longer require the WebGPURenderingContext
to be passed in.
- For WebGPUBuffer, WebGPUCommandQueue, WebGPUComputeCommandEncoder, WebGPUComputePipelineState,
WebGPUDepthStencilState, WebGPUDrawable, WebGPUFunction, WebGPULibrary, WebGPURenderCommandEncoder,
WebGPURenderPassDepthAttachmentDescriptor, WebGPURenderPipelineColorAttachmentDescriptor,
WebGPURenderPipelineState, and WebGPUTexture the WebGPURenderingContext and any other additional
parameters needed for initialization were replaced with the underlying type (e.g. WebGPUBuffer
now gets passed a GPUBuffer).
- WebGPUCommandBuffer is passed a GPUCommandQueue, since it needs to construct the underlying
GPUCommandBuffer itself so it can pass in the completion handler.
- For WebGPUDepthStencilDescriptor, WebGPURenderPassAttachmentDescriptor,
WebGPURenderPassColorAttachmentDescriptor, WebGPURenderPassDescriptor and WebGPURenderPipelineDescriptor
the create and constructor functions are empty.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
Remove WebGPUObject.h/cpp

* html/canvas/WebGPUBuffer.cpp:
(WebCore::WebGPUBuffer::WebGPUBuffer):
* html/canvas/WebGPUBuffer.h:
* html/canvas/WebGPUBuffer.idl:
Switch from inheriting from WebGPUObject to directly inheriting from
RefCounted<WebGPUBuffer>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create
and constructor to take a GPUBuffer directly, rather than the context.

* html/canvas/WebGPUCommandBuffer.cpp:
(WebCore::WebGPUCommandBuffer::create):
(WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
Update create and constructor to no longer require a context, as it would
now be unused, as it no longer inherits from WebGPUObject nor needs to hold
onto the context for any reason.

(WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
Update to call the new WebGPURenderCommandEncoder::create, which no longer
requires a context.

(WebCore::WebGPUCommandBuffer::createComputeCommandEncoder):
Update to call the new WebGPUComputeCommandEncoder::create, which no longer
requires a context.

* html/canvas/WebGPUCommandBuffer.h:
* html/canvas/WebGPUCommandBuffer.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPUCommandBuffer>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and constructor
to no longer take a context, and just take a GPUCommandQueue. We can't directly
pass a GPUCommandBuffer as WebGPUCommandBuffer needs to pass in a completion handler
on construction of the underlying GPUCommandBuffer.

* html/canvas/WebGPUCommandQueue.cpp:
(WebCore::WebGPUCommandQueue::WebGPUCommandQueue):
(WebCore::WebGPUCommandQueue::createCommandBuffer):
Update to call the new WebGPUCommandBuffer::create, which no longer
requires a context.

* html/canvas/WebGPUCommandQueue.h:
* html/canvas/WebGPUCommandQueue.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPUCommandQueue>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPUCommandQueue directly.

* html/canvas/WebGPUComputeCommandEncoder.cpp:
(WebCore::WebGPUComputeCommandEncoder::create):
(WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder):
* html/canvas/WebGPUComputeCommandEncoder.h:
* html/canvas/WebGPUComputeCommandEncoder.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPUComputeCommandEncoder>. Since this de-virtualizes it,
also add ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPUComputeCommandEncoder directly

* html/canvas/WebGPUComputePipelineState.cpp:
(WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState):
* html/canvas/WebGPUComputePipelineState.h:
* html/canvas/WebGPUComputePipelineState.idl:
Switch from inheriting from WebGPUObject to directly inheriting from
RefCounted<WebGPUComputePipelineState>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPUComputePipelineState directly.

* html/canvas/WebGPUDepthStencilDescriptor.cpp:
Remove unneeded include of include "WebGPURenderingContext.h".

* html/canvas/WebGPUDepthStencilDescriptor.h:
* html/canvas/WebGPUDepthStencilDescriptor.idl:
Switch from inheriting from WebGPUObject to directly inheriting from
RefCounted<WebGPUDepthStencilDescriptor>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file.

* html/canvas/WebGPUDepthStencilState.cpp:
(WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState):
* html/canvas/WebGPUDepthStencilState.h:
* html/canvas/WebGPUDepthStencilState.idl:
Switch from inheriting from WebGPUObject to directly inheriting from
RefCounted<WebGPUDepthStencilState>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPUDepthStencilState directly.

* html/canvas/WebGPUDrawable.cpp:
(WebCore::WebGPUDrawable::WebGPUDrawable):
* html/canvas/WebGPUDrawable.h:
* html/canvas/WebGPUDrawable.idl:
Switch from inheriting from WebGPUObject to directly inheriting from
RefCounted<WebGPUDrawable>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPUDrawable directly.

* html/canvas/WebGPUFunction.cpp:
(WebCore::WebGPUFunction::create):
(WebCore::WebGPUFunction::WebGPUFunction):
* html/canvas/WebGPUFunction.h:
* html/canvas/WebGPUFunction.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPUFunction>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPUFunction directly.

* html/canvas/WebGPULibrary.cpp:
(WebCore::WebGPULibrary::WebGPULibrary):
(WebCore::WebGPULibrary::functionWithName const):
Update for new WebGPUFunction::create, which no longer requires a
context.

* html/canvas/WebGPULibrary.h:
* html/canvas/WebGPULibrary.idl:
Switch from inheriting from WebGPUObject to directly inheriting from
RefCounted<WebGPULibrary>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPULibrary directly, rather than the context.
Unlike the other create functions that take their underlying type, this
one also continues to need the sourceCode String to be passed, as that
is not available from the underlying GPULibrary and must be stored
seperately.

* html/canvas/WebGPUObject.cpp: Removed.
* html/canvas/WebGPUObject.h: Removed.
Deleted.

* html/canvas/WebGPURenderCommandEncoder.cpp:
(WebCore::WebGPURenderCommandEncoder::create):
(WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder):
* html/canvas/WebGPURenderCommandEncoder.h:
* html/canvas/WebGPURenderCommandEncoder.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPURenderCommandEncoder>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPURenderCommandEncoder directly.

* html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
(WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
* html/canvas/WebGPURenderPassAttachmentDescriptor.h:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPURenderPassAttachmentDescriptor>. Also update create and
constructor to no longer take a context, as it is now not used. This remains virtual
as it is inherited from by WebGPURenderPassColorAttachmentDescriptor and WebGPURenderPassDepthAttachmentDescriptor.

* html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
(WebCore::WebGPURenderPassColorAttachmentDescriptor::create):
(WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor):
* html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
Update create and constructor to no longer take a context, as it is now not used. Declare final
as this is not inherited by anything.

* html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
(WebCore::WebGPURenderPassDepthAttachmentDescriptor::create):
(WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor):
* html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
Update create and constructor to no longer take a context, as it is now not used. Declare final
as this is not inherited by anything.

* html/canvas/WebGPURenderPassDescriptor.cpp:
(WebCore::WebGPURenderPassDescriptor::depthAttachment):
Update for new WebGPURenderPassDepthAttachmentDescriptor::create function which no longer requires
a context.

Semi-interesting note: This function was previously calling "*context()" to pass a WebGPURenderingContext&
to WebGPURenderPassDepthAttachmentDescriptor::create. However, "context()" was always returning null, as
the constructor of WebGPURenderPassDescriptor was not initializing the WebGPUObject with a WebGPURenderingContext.
Now, one might think that this would cause a null-deref, but, because it was being assigned into a
WebGPURenderingContext&, no dereference happens right away (it essentially just passes a pointer) and since
the function it is being passed to does not use it, it never actually gets dereferenced.

(WebCore::WebGPURenderPassDescriptor::colorAttachments):
Update for new WebGPURenderPassColorAttachmentDescriptor::create function which no longer requires
a context.

* html/canvas/WebGPURenderPassDescriptor.h:
* html/canvas/WebGPURenderPassDescriptor.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPURenderPassDescriptor>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file.

* html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
(WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create):
(WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor):
* html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
* html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPURenderPipelineColorAttachmentDescriptor>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and constructor to
no longer take a context, as it is now not used.

* html/canvas/WebGPURenderPipelineDescriptor.cpp:
(WebCore::WebGPURenderPipelineDescriptor::colorAttachments):
Update for new WebGPURenderPipelineColorAttachmentDescriptor::create which no longer requires
a context.

* html/canvas/WebGPURenderPipelineDescriptor.h:
* html/canvas/WebGPURenderPipelineDescriptor.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPURenderPipelineDescriptor>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file.

* html/canvas/WebGPURenderPipelineState.cpp:
(WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState):
* html/canvas/WebGPURenderPipelineState.h:
* html/canvas/WebGPURenderPipelineState.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPURenderPipelineState>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file. Also update create and
constructor to take a GPURenderPipelineState directly.

* html/canvas/WebGPURenderingContext.cpp:
(WebCore::WebGPURenderingContext::createLibrary):
(WebCore::WebGPURenderingContext::createRenderPipelineState):
(WebCore::WebGPURenderingContext::createDepthStencilState):
(WebCore::WebGPURenderingContext::createComputePipelineState):
(WebCore::WebGPURenderingContext::createCommandQueue):
(WebCore::WebGPURenderingContext::nextDrawable):
(WebCore::WebGPURenderingContext::createBuffer):
(WebCore::WebGPURenderingContext::createTexture):
Update for new create functions which require the caller to pass
the underlying type.

* html/canvas/WebGPUTexture.cpp:
(WebCore::WebGPUTexture::createFromDrawableTexture):
Renamed to create.

(WebCore::WebGPUTexture::create): Deleted
All callers now pass a GPUTexture directly.

* html/canvas/WebGPUTexture.h:
* html/canvas/WebGPUTexture.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPUTexture>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file.

* html/canvas/WebGPUTextureDescriptor.h:
* html/canvas/WebGPUTextureDescriptor.idl:
Switch from inheriting from GPUObject to directly inheriting from
RefCounted<WebGPUTextureDescriptor>. Since this de-virtualizes it, also add
ImplementationLacksVTable to the IDL file.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234563 => 234564)


--- trunk/Source/WebCore/ChangeLog	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/ChangeLog	2018-08-03 23:25:56 UTC (rev 234564)
@@ -1,3 +1,273 @@
+2018-08-03  Sam Weinig  <[email protected]>
+
+        Remove WebGPUObject
+        https://bugs.webkit.org/show_bug.cgi?id=188114
+
+        Reviewed by Darin Adler.
+
+        This removes the unecessary WebGPUObject base class and updates the classes
+        that were inheriting from it to instead inherit directly from RefCounted. This
+        shrinks the size of all the classes that were inheriting from it, as they no
+        longer store a RefPtr<WebGPURenderingContext> member, which is unused. Most
+        of the classes also shrink because they can be devirtualized.
+
+        This also updates most of the create functions and constructors for the classes
+        that were inheriting from WebGPUObject to no longer require the WebGPURenderingContext
+        to be passed in. 
+        - For WebGPUBuffer, WebGPUCommandQueue, WebGPUComputeCommandEncoder, WebGPUComputePipelineState, 
+        WebGPUDepthStencilState, WebGPUDrawable, WebGPUFunction, WebGPULibrary, WebGPURenderCommandEncoder, 
+        WebGPURenderPassDepthAttachmentDescriptor, WebGPURenderPipelineColorAttachmentDescriptor, 
+        WebGPURenderPipelineState, and WebGPUTexture the WebGPURenderingContext and any other additional 
+        parameters needed for initialization were replaced with the underlying type (e.g. WebGPUBuffer 
+        now gets passed a GPUBuffer).
+        - WebGPUCommandBuffer is passed a GPUCommandQueue, since it needs to construct the underlying
+        GPUCommandBuffer itself so it can pass in the completion handler.
+        - For WebGPUDepthStencilDescriptor, WebGPURenderPassAttachmentDescriptor, 
+        WebGPURenderPassColorAttachmentDescriptor, WebGPURenderPassDescriptor and WebGPURenderPipelineDescriptor
+        the create and constructor functions are empty.        
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        Remove WebGPUObject.h/cpp
+
+        * html/canvas/WebGPUBuffer.cpp:
+        (WebCore::WebGPUBuffer::WebGPUBuffer):
+        * html/canvas/WebGPUBuffer.h:
+        * html/canvas/WebGPUBuffer.idl:
+        Switch from inheriting from WebGPUObject to directly inheriting from 
+        RefCounted<WebGPUBuffer>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create 
+        and constructor to take a GPUBuffer directly, rather than the context.
+
+        * html/canvas/WebGPUCommandBuffer.cpp:
+        (WebCore::WebGPUCommandBuffer::create):
+        (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
+        Update create and constructor to no longer require a context, as it would
+        now be unused, as it no longer inherits from WebGPUObject nor needs to hold
+        onto the context for any reason.
+
+        (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
+        Update to call the new WebGPURenderCommandEncoder::create, which no longer
+        requires a context.
+
+        (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder):
+        Update to call the new WebGPUComputeCommandEncoder::create, which no longer
+        requires a context.
+
+        * html/canvas/WebGPUCommandBuffer.h:
+        * html/canvas/WebGPUCommandBuffer.idl:
+        Switch from inheriting from GPUObject to directly inheriting from 
+        RefCounted<WebGPUCommandBuffer>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and constructor 
+        to no longer take a context, and just take a GPUCommandQueue. We can't directly
+        pass a GPUCommandBuffer as WebGPUCommandBuffer needs to pass in a completion handler
+        on construction of the underlying GPUCommandBuffer.
+        
+        * html/canvas/WebGPUCommandQueue.cpp:
+        (WebCore::WebGPUCommandQueue::WebGPUCommandQueue):
+        (WebCore::WebGPUCommandQueue::createCommandBuffer):
+        Update to call the new WebGPUCommandBuffer::create, which no longer
+        requires a context.
+    
+        * html/canvas/WebGPUCommandQueue.h:
+        * html/canvas/WebGPUCommandQueue.idl:
+        Switch from inheriting from GPUObject to directly inheriting from 
+        RefCounted<WebGPUCommandQueue>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPUCommandQueue directly.
+
+        * html/canvas/WebGPUComputeCommandEncoder.cpp:
+        (WebCore::WebGPUComputeCommandEncoder::create):
+        (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder):
+        * html/canvas/WebGPUComputeCommandEncoder.h:
+        * html/canvas/WebGPUComputeCommandEncoder.idl:
+        Switch from inheriting from GPUObject to directly inheriting from 
+        RefCounted<WebGPUComputeCommandEncoder>. Since this de-virtualizes it, 
+        also add ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPUComputeCommandEncoder directly
+
+        * html/canvas/WebGPUComputePipelineState.cpp:
+        (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState):
+        * html/canvas/WebGPUComputePipelineState.h:
+        * html/canvas/WebGPUComputePipelineState.idl:
+        Switch from inheriting from WebGPUObject to directly inheriting from 
+        RefCounted<WebGPUComputePipelineState>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPUComputePipelineState directly.
+
+        * html/canvas/WebGPUDepthStencilDescriptor.cpp:
+        Remove unneeded include of include "WebGPURenderingContext.h".
+
+        * html/canvas/WebGPUDepthStencilDescriptor.h:
+        * html/canvas/WebGPUDepthStencilDescriptor.idl:
+        Switch from inheriting from WebGPUObject to directly inheriting from 
+        RefCounted<WebGPUDepthStencilDescriptor>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file.
+
+        * html/canvas/WebGPUDepthStencilState.cpp:
+        (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState):
+        * html/canvas/WebGPUDepthStencilState.h:
+        * html/canvas/WebGPUDepthStencilState.idl:
+        Switch from inheriting from WebGPUObject to directly inheriting from 
+        RefCounted<WebGPUDepthStencilState>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPUDepthStencilState directly.
+
+        * html/canvas/WebGPUDrawable.cpp:
+        (WebCore::WebGPUDrawable::WebGPUDrawable):
+        * html/canvas/WebGPUDrawable.h:
+        * html/canvas/WebGPUDrawable.idl:
+        Switch from inheriting from WebGPUObject to directly inheriting from 
+        RefCounted<WebGPUDrawable>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPUDrawable directly.
+
+        * html/canvas/WebGPUFunction.cpp:
+        (WebCore::WebGPUFunction::create):
+        (WebCore::WebGPUFunction::WebGPUFunction):
+        * html/canvas/WebGPUFunction.h:
+        * html/canvas/WebGPUFunction.idl:
+        Switch from inheriting from GPUObject to directly inheriting from 
+        RefCounted<WebGPUFunction>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPUFunction directly.
+
+        * html/canvas/WebGPULibrary.cpp:
+        (WebCore::WebGPULibrary::WebGPULibrary):
+        (WebCore::WebGPULibrary::functionWithName const):
+        Update for new WebGPUFunction::create, which no longer requires a
+        context.
+
+        * html/canvas/WebGPULibrary.h:
+        * html/canvas/WebGPULibrary.idl:
+        Switch from inheriting from WebGPUObject to directly inheriting from 
+        RefCounted<WebGPULibrary>. Since this de-virtualizes it, also add 
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPULibrary directly, rather than the context.
+        Unlike the other create functions that take their underlying type, this
+        one also continues to need the sourceCode String to be passed, as that
+        is not available from the underlying GPULibrary and must be stored
+        seperately.
+
+        * html/canvas/WebGPUObject.cpp: Removed.
+        * html/canvas/WebGPUObject.h: Removed.
+        Deleted.
+
+        * html/canvas/WebGPURenderCommandEncoder.cpp:
+        (WebCore::WebGPURenderCommandEncoder::create):
+        (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder):
+        * html/canvas/WebGPURenderCommandEncoder.h:
+        * html/canvas/WebGPURenderCommandEncoder.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPURenderCommandEncoder>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPURenderCommandEncoder directly.
+
+        * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
+        (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
+        * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
+        Switch from inheriting from GPUObject to directly inheriting from 
+        RefCounted<WebGPURenderPassAttachmentDescriptor>. Also update create and 
+        constructor to no longer take a context, as it is now not used. This remains virtual
+        as it is inherited from by WebGPURenderPassColorAttachmentDescriptor and WebGPURenderPassDepthAttachmentDescriptor.
+
+        * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
+        (WebCore::WebGPURenderPassColorAttachmentDescriptor::create):
+        (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor):
+        * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
+        Update create and constructor to no longer take a context, as it is now not used. Declare final
+        as this is not inherited by anything.
+
+        * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
+        (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create):
+        (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor):
+        * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
+        Update create and constructor to no longer take a context, as it is now not used. Declare final
+        as this is not inherited by anything.
+
+        * html/canvas/WebGPURenderPassDescriptor.cpp:
+        (WebCore::WebGPURenderPassDescriptor::depthAttachment):
+        Update for new WebGPURenderPassDepthAttachmentDescriptor::create function which no longer requires
+        a context. 
+        
+        Semi-interesting note: This function was previously calling "*context()" to pass a WebGPURenderingContext&
+        to WebGPURenderPassDepthAttachmentDescriptor::create. However, "context()" was always returning null, as
+        the constructor of WebGPURenderPassDescriptor was not initializing the WebGPUObject with a WebGPURenderingContext.
+        Now, one might think that this would cause a null-deref, but, because it was being assigned into a 
+        WebGPURenderingContext&, no dereference happens right away (it essentially just passes a pointer) and since
+        the function it is being passed to does not use it, it never actually gets dereferenced.
+
+        (WebCore::WebGPURenderPassDescriptor::colorAttachments):
+        Update for new WebGPURenderPassColorAttachmentDescriptor::create function which no longer requires
+        a context. 
+
+        * html/canvas/WebGPURenderPassDescriptor.h:
+        * html/canvas/WebGPURenderPassDescriptor.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPURenderPassDescriptor>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file.
+
+        * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
+        (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create):
+        (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor):
+        * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
+        * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPURenderPipelineColorAttachmentDescriptor>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file. Also update create and constructor to
+        no longer take a context, as it is now not used.
+
+        * html/canvas/WebGPURenderPipelineDescriptor.cpp:
+        (WebCore::WebGPURenderPipelineDescriptor::colorAttachments):
+        Update for new WebGPURenderPipelineColorAttachmentDescriptor::create which no longer requires
+        a context.
+
+        * html/canvas/WebGPURenderPipelineDescriptor.h:
+        * html/canvas/WebGPURenderPipelineDescriptor.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPURenderPipelineDescriptor>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file.
+
+        * html/canvas/WebGPURenderPipelineState.cpp:
+        (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState):
+        * html/canvas/WebGPURenderPipelineState.h:
+        * html/canvas/WebGPURenderPipelineState.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPURenderPipelineState>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file. Also update create and
+        constructor to take a GPURenderPipelineState directly.
+
+        * html/canvas/WebGPURenderingContext.cpp:
+        (WebCore::WebGPURenderingContext::createLibrary):
+        (WebCore::WebGPURenderingContext::createRenderPipelineState):
+        (WebCore::WebGPURenderingContext::createDepthStencilState):
+        (WebCore::WebGPURenderingContext::createComputePipelineState):
+        (WebCore::WebGPURenderingContext::createCommandQueue):
+        (WebCore::WebGPURenderingContext::nextDrawable):
+        (WebCore::WebGPURenderingContext::createBuffer):
+        (WebCore::WebGPURenderingContext::createTexture):
+        Update for new create functions which require the caller to pass
+        the underlying type.
+
+        * html/canvas/WebGPUTexture.cpp:
+        (WebCore::WebGPUTexture::createFromDrawableTexture):
+        Renamed to create.
+
+        (WebCore::WebGPUTexture::create): Deleted
+        All callers now pass a GPUTexture directly.
+
+        * html/canvas/WebGPUTexture.h:
+        * html/canvas/WebGPUTexture.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPUTexture>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file. 
+
+        * html/canvas/WebGPUTextureDescriptor.h:
+        * html/canvas/WebGPUTextureDescriptor.idl:
+        Switch from inheriting from GPUObject to directly inheriting from
+        RefCounted<WebGPUTextureDescriptor>. Since this de-virtualizes it, also add
+        ImplementationLacksVTable to the IDL file.
+
 2018-08-03  Alex Christensen  <[email protected]>
 
         Fix spelling of "overridden"

Modified: trunk/Source/WebCore/Sources.txt (234563 => 234564)


--- trunk/Source/WebCore/Sources.txt	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/Sources.txt	2018-08-03 23:25:56 UTC (rev 234564)
@@ -1113,7 +1113,6 @@
 html/canvas/WebGPUEnums.cpp
 html/canvas/WebGPUFunction.cpp
 html/canvas/WebGPULibrary.cpp
-html/canvas/WebGPUObject.cpp
 html/canvas/WebGPURenderCommandEncoder.cpp
 html/canvas/WebGPURenderPassAttachmentDescriptor.cpp
 html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (234563 => 234564)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2018-08-03 23:25:56 UTC (rev 234564)
@@ -6940,8 +6940,6 @@
 		31A088DE1E737B4D003B6609 /* WebGPULibrary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPULibrary.cpp; sourceTree = "<group>"; };
 		31A088DF1E737B4D003B6609 /* WebGPULibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPULibrary.h; sourceTree = "<group>"; };
 		31A088E01E737B4D003B6609 /* WebGPULibrary.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGPULibrary.idl; sourceTree = "<group>"; };
-		31A088E11E737B4D003B6609 /* WebGPUObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPUObject.cpp; sourceTree = "<group>"; };
-		31A088E21E737B4D003B6609 /* WebGPUObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPUObject.h; sourceTree = "<group>"; };
 		31A088E31E737B4D003B6609 /* WebGPURenderCommandEncoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGPURenderCommandEncoder.cpp; sourceTree = "<group>"; };
 		31A088E41E737B4D003B6609 /* WebGPURenderCommandEncoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGPURenderCommandEncoder.h; sourceTree = "<group>"; };
 		31A088E51E737B4D003B6609 /* WebGPURenderCommandEncoder.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebGPURenderCommandEncoder.idl; sourceTree = "<group>"; };
@@ -17470,8 +17468,6 @@
 				31A088DE1E737B4D003B6609 /* WebGPULibrary.cpp */,
 				31A088DF1E737B4D003B6609 /* WebGPULibrary.h */,
 				31A088E01E737B4D003B6609 /* WebGPULibrary.idl */,
-				31A088E11E737B4D003B6609 /* WebGPUObject.cpp */,
-				31A088E21E737B4D003B6609 /* WebGPUObject.h */,
 				31A088E31E737B4D003B6609 /* WebGPURenderCommandEncoder.cpp */,
 				31A088E41E737B4D003B6609 /* WebGPURenderCommandEncoder.h */,
 				31A088E51E737B4D003B6609 /* WebGPURenderCommandEncoder.idl */,

Modified: trunk/Source/WebCore/html/canvas/WebGPUBuffer.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUBuffer.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUBuffer.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,19 +28,16 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPURenderingContext.h"
-
 namespace WebCore {
 
-RefPtr<WebGPUBuffer> WebGPUBuffer::create(WebGPURenderingContext& context, const JSC::ArrayBufferView& data)
+RefPtr<WebGPUBuffer> WebGPUBuffer::create(GPUBuffer&& buffer)
 {
     // FIXME: Consider returning null rather than a buffer with length 0 and contents null when creation fails.
-    return adoptRef(*new WebGPUBuffer(context, data));
+    return adoptRef(*new WebGPUBuffer(WTFMove(buffer)));
 }
 
-WebGPUBuffer::WebGPUBuffer(WebGPURenderingContext& context, const JSC::ArrayBufferView& data)
-    : WebGPUObject { &context }
-    , m_buffer { context.device(), data }
+WebGPUBuffer::WebGPUBuffer(GPUBuffer&& buffer)
+    : m_buffer { WTFMove(buffer) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUBuffer.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUBuffer.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUBuffer.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,13 +28,14 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUBuffer.h"
-#include "WebGPUObject.h"
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
-class WebGPUBuffer : public WebGPUObject {
+class WebGPUBuffer : public RefCounted<WebGPUBuffer> {
 public:
-    static RefPtr<WebGPUBuffer> create(WebGPURenderingContext&, const JSC::ArrayBufferView&);
+    static RefPtr<WebGPUBuffer> create(GPUBuffer&&);
 
     unsigned length() const { return m_buffer.length(); }
     JSC::ArrayBuffer& contents() const { return *m_buffer.contents(); }
@@ -42,7 +43,7 @@
     const GPUBuffer& buffer() const { return m_buffer; }
 
 private:
-    WebGPUBuffer(WebGPURenderingContext&, const JSC::ArrayBufferView&);
+    explicit WebGPUBuffer(GPUBuffer&&);
 
     GPUBuffer m_buffer;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUBuffer.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUBuffer.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUBuffer.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUBuffer {
 
     readonly attribute unsigned long length;

Modified: trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -36,18 +36,16 @@
 #include "WebGPUDrawable.h"
 #include "WebGPURenderCommandEncoder.h"
 #include "WebGPURenderPassDescriptor.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
-Ref<WebGPUCommandBuffer> WebGPUCommandBuffer::create(WebGPURenderingContext& context, const GPUCommandQueue& queue)
+Ref<WebGPUCommandBuffer> WebGPUCommandBuffer::create(const GPUCommandQueue& queue)
 {
-    return adoptRef(*new WebGPUCommandBuffer(context, queue));
+    return adoptRef(*new WebGPUCommandBuffer(queue));
 }
 
-WebGPUCommandBuffer::WebGPUCommandBuffer(WebGPURenderingContext& context, const GPUCommandQueue& queue)
-    : WebGPUObject { &context }
-    , m_buffer { queue, [this] () { m_completed.resolve(); } }
+WebGPUCommandBuffer::WebGPUCommandBuffer(const GPUCommandQueue& queue)
+    : m_buffer { queue, [this] () { m_completed.resolve(); } }
 {
     LOG(WebGPU, "WebGPUCommandBuffer::WebGPUCommandBuffer()");
 }
@@ -71,12 +69,12 @@
 
 Ref<WebGPURenderCommandEncoder> WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor(WebGPURenderPassDescriptor& descriptor)
 {
-    return WebGPURenderCommandEncoder::create(*context(), m_buffer, descriptor.descriptor());
+    return WebGPURenderCommandEncoder::create(GPURenderCommandEncoder { m_buffer, descriptor.descriptor() });
 }
 
 Ref<WebGPUComputeCommandEncoder> WebGPUCommandBuffer::createComputeCommandEncoder()
 {
-    return WebGPUComputeCommandEncoder::create(*context(), m_buffer);
+    return WebGPUComputeCommandEncoder::create(GPUComputeCommandEncoder { m_buffer });
 }
 
 DOMPromiseProxy<IDLVoid>& WebGPUCommandBuffer::completed()

Modified: trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -30,7 +30,8 @@
 
 #include "DOMPromiseProxy.h"
 #include "GPUCommandBuffer.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
@@ -39,10 +40,10 @@
 class WebGPURenderCommandEncoder;
 class WebGPURenderPassDescriptor;
 
-class WebGPUCommandBuffer : public WebGPUObject {
+class WebGPUCommandBuffer : public RefCounted<WebGPUCommandBuffer> {
 public:
-    virtual ~WebGPUCommandBuffer();
-    static Ref<WebGPUCommandBuffer> create(WebGPURenderingContext&, const GPUCommandQueue&);
+    ~WebGPUCommandBuffer();
+    static Ref<WebGPUCommandBuffer> create(const GPUCommandQueue&);
 
     void commit();
     void presentDrawable(WebGPUDrawable&);
@@ -55,7 +56,7 @@
     const GPUCommandBuffer& buffer() const { return m_buffer; }
 
 private:
-    WebGPUCommandBuffer(WebGPURenderingContext&, const GPUCommandQueue&);
+    explicit WebGPUCommandBuffer(const GPUCommandQueue&);
 
     GPUCommandBuffer m_buffer;
     DOMPromiseProxy<IDLVoid> m_completed;

Modified: trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUCommandBuffer.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -26,7 +26,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUCommandBuffer {
     WebGPURenderCommandEncoder createRenderCommandEncoderWithDescriptor(WebGPURenderPassDescriptor descriptor);
     WebGPUComputeCommandEncoder createComputeCommandEncoder();
@@ -33,5 +34,4 @@
     void commit();
     void presentDrawable(WebGPUDrawable drawable);
     readonly attribute Promise<void> completed;
-
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,18 +29,16 @@
 #if ENABLE(WEBGPU)
 
 #include "WebGPUCommandBuffer.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
-Ref<WebGPUCommandQueue> WebGPUCommandQueue::create(WebGPURenderingContext& context)
+Ref<WebGPUCommandQueue> WebGPUCommandQueue::create(GPUCommandQueue&& queue)
 {
-    return adoptRef(*new WebGPUCommandQueue(context));
+    return adoptRef(*new WebGPUCommandQueue(WTFMove(queue)));
 }
 
-WebGPUCommandQueue::WebGPUCommandQueue(WebGPURenderingContext& context)
-    : WebGPUObject { &context }
-    , m_queue { context.device() }
+WebGPUCommandQueue::WebGPUCommandQueue(GPUCommandQueue&& queue)
+    : m_queue { WTFMove(queue) }
 {
 }
 
@@ -48,7 +46,7 @@
 
 Ref<WebGPUCommandBuffer> WebGPUCommandQueue::createCommandBuffer()
 {
-    return WebGPUCommandBuffer::create(*context(), m_queue);
+    return WebGPUCommandBuffer::create(m_queue);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,16 +28,17 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUCommandQueue.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class WebGPUCommandBuffer;
 
-class WebGPUCommandQueue : public WebGPUObject {
+class WebGPUCommandQueue : public RefCounted<WebGPUCommandQueue> {
 public:
-    virtual ~WebGPUCommandQueue();
-    static Ref<WebGPUCommandQueue> create(WebGPURenderingContext&);
+    ~WebGPUCommandQueue();
+    static Ref<WebGPUCommandQueue> create(GPUCommandQueue&&);
 
     String label() const { return m_queue.label(); }
     void setLabel(const String& label) { m_queue.setLabel(label); }
@@ -45,7 +46,7 @@
     Ref<WebGPUCommandBuffer> createCommandBuffer();
 
 private:
-    explicit WebGPUCommandQueue(WebGPURenderingContext&);
+    explicit WebGPUCommandQueue(GPUCommandQueue&&);
 
     GPUCommandQueue m_queue;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUCommandQueue.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUCommandQueue {
 
     attribute DOMString label;

Modified: trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -34,7 +34,6 @@
 #include "WebGPUBuffer.h"
 #include "WebGPUCommandBuffer.h"
 #include "WebGPUComputePipelineState.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
@@ -43,14 +42,13 @@
     return { size.width, size.height, size.depth };
 }
 
-Ref<WebGPUComputeCommandEncoder> WebGPUComputeCommandEncoder::create(WebGPURenderingContext& context, const GPUCommandBuffer& buffer)
+Ref<WebGPUComputeCommandEncoder> WebGPUComputeCommandEncoder::create(GPUComputeCommandEncoder&& encoder)
 {
-    return adoptRef(*new WebGPUComputeCommandEncoder(context, buffer));
+    return adoptRef(*new WebGPUComputeCommandEncoder(WTFMove(encoder)));
 }
     
-WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder(WebGPURenderingContext& context, const GPUCommandBuffer& buffer)
-    : WebGPUObject { &context }
-    , m_encoder { buffer }
+WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder(GPUComputeCommandEncoder&& encoder)
+    : m_encoder { WTFMove(encoder) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,8 +28,9 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUComputeCommandEncoder.h"
-#include "WebGPUObject.h"
 #include "WebGPUSize.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
@@ -36,9 +37,9 @@
 class WebGPUBuffer;
 class WebGPUComputePipelineState;
 
-class WebGPUComputeCommandEncoder : public WebGPUObject {
+class WebGPUComputeCommandEncoder : public RefCounted<WebGPUComputeCommandEncoder> {
 public:
-    static Ref<WebGPUComputeCommandEncoder> create(WebGPURenderingContext&, const GPUCommandBuffer&);
+    static Ref<WebGPUComputeCommandEncoder> create(GPUComputeCommandEncoder&&);
 
     void setComputePipelineState(WebGPUComputePipelineState&);
     void setBuffer(WebGPUBuffer&, unsigned, unsigned);
@@ -46,7 +47,7 @@
     void endEncoding();
 
 private:
-    WebGPUComputeCommandEncoder(WebGPURenderingContext&, const GPUCommandBuffer&);
+    explicit WebGPUComputeCommandEncoder(GPUComputeCommandEncoder&&);
 
     GPUComputeCommandEncoder m_encoder;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUComputeCommandEncoder.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUComputeCommandEncoder {
 
     void setComputePipelineState(WebGPUComputePipelineState pipelineState);

Modified: trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -30,14 +30,13 @@
 
 namespace WebCore {
 
-Ref<WebGPUComputePipelineState> WebGPUComputePipelineState::create(WebGPURenderingContext& context, const GPUFunction& function)
+Ref<WebGPUComputePipelineState> WebGPUComputePipelineState::create(GPUComputePipelineState&& state)
 {
-    return adoptRef(*new WebGPUComputePipelineState(context, function));
+    return adoptRef(*new WebGPUComputePipelineState(WTFMove(state)));
 }
 
-WebGPUComputePipelineState::WebGPUComputePipelineState(WebGPURenderingContext& context, const GPUFunction& function)
-    : WebGPUObject { &context }
-    , m_state { context.device(), function }
+WebGPUComputePipelineState::WebGPUComputePipelineState(GPUComputePipelineState&& state)
+    : m_state { WTFMove(state) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,20 +28,21 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUComputePipelineState.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class WebGPUFunction;
 
-class WebGPUComputePipelineState : public WebGPUObject {
+class WebGPUComputePipelineState : public RefCounted<WebGPUComputePipelineState> {
 public:
-    static Ref<WebGPUComputePipelineState> create(WebGPURenderingContext&, const GPUFunction&);
+    static Ref<WebGPUComputePipelineState> create(GPUComputePipelineState&&);
 
     GPUComputePipelineState& state() { return m_state; }
 
 private:
-    WebGPUComputePipelineState(WebGPURenderingContext&, const GPUFunction&);
+    explicit WebGPUComputePipelineState(GPUComputePipelineState&&);
 
     GPUComputePipelineState m_state;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUComputePipelineState.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,6 +25,7 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUComputePipelineState {
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,8 +28,6 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPURenderingContext.h"
-
 namespace WebCore {
 
 Ref<WebGPUDepthStencilDescriptor> WebGPUDepthStencilDescriptor::create()

Modified: trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,11 +29,12 @@
 
 #include "GPUDepthStencilDescriptor.h"
 #include "WebGPUEnums.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class WebGPUDepthStencilDescriptor : public WebGPUObject {
+class WebGPUDepthStencilDescriptor : public RefCounted<WebGPUDepthStencilDescriptor> {
 public:
     static Ref<WebGPUDepthStencilDescriptor> create();
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -40,7 +40,8 @@
 [
     Constructor,
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUDepthStencilDescriptor {
 
     attribute WebGPUCompareFunction depthCompareFunction;

Modified: trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,18 +29,17 @@
 #if ENABLE(WEBGPU)
 
 #include "WebGPUDepthStencilDescriptor.h"
-#include "WebGPURenderingContext.h"
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-Ref<WebGPUDepthStencilState> WebGPUDepthStencilState::create(WebGPURenderingContext& context, const GPUDepthStencilDescriptor& descriptor)
+Ref<WebGPUDepthStencilState> WebGPUDepthStencilState::create(GPUDepthStencilState&& state)
 {
-    return adoptRef(*new WebGPUDepthStencilState(context, descriptor));
+    return adoptRef(*new WebGPUDepthStencilState(WTFMove(state)));
 }
 
-WebGPUDepthStencilState::WebGPUDepthStencilState(WebGPURenderingContext& context, const GPUDepthStencilDescriptor& descriptor)
-    : WebGPUObject { &context }
-    , m_state { context.device(), descriptor }
+WebGPUDepthStencilState::WebGPUDepthStencilState(GPUDepthStencilState&& state)
+    : m_state { WTFMove(state) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,13 +28,14 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUDepthStencilState.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class WebGPUDepthStencilState : public WebGPUObject {
+class WebGPUDepthStencilState : public RefCounted<WebGPUDepthStencilState> {
 public:
-    static Ref<WebGPUDepthStencilState> create(WebGPURenderingContext&, const GPUDepthStencilDescriptor&);
+    static Ref<WebGPUDepthStencilState> create(GPUDepthStencilState&&);
 
     String label() const;
     void setLabel(const String&);
@@ -42,7 +43,7 @@
     GPUDepthStencilState& state() { return m_state; }
 
 private:
-    WebGPUDepthStencilState(WebGPURenderingContext&, const GPUDepthStencilDescriptor&);
+    explicit WebGPUDepthStencilState(GPUDepthStencilState&&);
 
     GPUDepthStencilState m_state;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDepthStencilState.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUDepthStencilState {
 
     attribute DOMString label;

Modified: trunk/Source/WebCore/html/canvas/WebGPUDrawable.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDrawable.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDrawable.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,20 +29,18 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUTexture.h"
-#include "WebGPURenderingContext.h"
 #include "WebGPUTexture.h"
 
 namespace WebCore {
 
-Ref<WebGPUDrawable> WebGPUDrawable::create(WebGPURenderingContext& context)
+Ref<WebGPUDrawable> WebGPUDrawable::create(GPUDrawable&& drawable)
 {
-    return adoptRef(*new WebGPUDrawable(context));
+    return adoptRef(*new WebGPUDrawable(WTFMove(drawable)));
 }
 
-WebGPUDrawable::WebGPUDrawable(WebGPURenderingContext& context)
-    : WebGPUObject { &context }
-    , m_drawable { context.device() }
-    , m_texture { WebGPUTexture::createFromDrawableTexture(context, GPUTexture { m_drawable }) }
+WebGPUDrawable::WebGPUDrawable(GPUDrawable&& drawable)
+    : m_drawable { WTFMove(drawable) }
+    , m_texture { WebGPUTexture::create(GPUTexture { m_drawable }) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUDrawable.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDrawable.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDrawable.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,22 +28,23 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUDrawable.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class WebGPUTexture;
 
-class WebGPUDrawable : public WebGPUObject {
+class WebGPUDrawable : public RefCounted<WebGPUDrawable> {
 public:
-    virtual ~WebGPUDrawable();
-    static Ref<WebGPUDrawable> create(WebGPURenderingContext&);
+    ~WebGPUDrawable();
+    static Ref<WebGPUDrawable> create(GPUDrawable&&);
 
     GPUDrawable& drawable() { return m_drawable; }
     WebGPUTexture& texture() { return m_texture.get(); }
 
 private:
-    explicit WebGPUDrawable(WebGPURenderingContext&);
+    explicit WebGPUDrawable(GPUDrawable&&);
 
     GPUDrawable m_drawable;
     Ref<WebGPUTexture> m_texture;

Modified: trunk/Source/WebCore/html/canvas/WebGPUDrawable.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUDrawable.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUDrawable.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUDrawable {
 
     readonly attribute WebGPUTexture texture; // FIXME: Only the framebuffer should have this.

Modified: trunk/Source/WebCore/html/canvas/WebGPUEnums.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUEnums.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUEnums.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,6 +29,7 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUEnums.h"
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUFunction.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUFunction.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUFunction.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,18 +29,16 @@
 #if ENABLE(WEBGPU)
 
 #include "WebGPULibrary.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
-Ref<WebGPUFunction> WebGPUFunction::create(WebGPURenderingContext& context, GPUFunction&& function)
+Ref<WebGPUFunction> WebGPUFunction::create(GPUFunction&& function)
 {
-    return adoptRef(*new WebGPUFunction(context, WTFMove(function)));
+    return adoptRef(*new WebGPUFunction(WTFMove(function)));
 }
 
-WebGPUFunction::WebGPUFunction(WebGPURenderingContext& context, GPUFunction&& function)
-    : WebGPUObject { &context }
-    , m_function { WTFMove(function) }
+WebGPUFunction::WebGPUFunction(GPUFunction&& function)
+    : m_function { WTFMove(function) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUFunction.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUFunction.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUFunction.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,19 +28,21 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUFunction.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
-class WebGPUFunction : public WebGPUObject {
+class WebGPUFunction : public RefCounted<WebGPUFunction> {
 public:
-    static Ref<WebGPUFunction> create(WebGPURenderingContext&, GPUFunction&&);
+    static Ref<WebGPUFunction> create(GPUFunction&&);
 
     String name() const { return m_function.name(); }
     const GPUFunction& function() const { return m_function; }
 
 private:
-    WebGPUFunction(WebGPURenderingContext&, GPUFunction&&);
+    explicit WebGPUFunction(GPUFunction&&);
 
     GPUFunction m_function;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUFunction.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUFunction.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUFunction.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUFunction {
 
     readonly attribute DOMString name;

Modified: trunk/Source/WebCore/html/canvas/WebGPULibrary.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPULibrary.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPULibrary.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,19 +29,17 @@
 #if ENABLE(WEBGPU)
 
 #include "WebGPUFunction.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
-Ref<WebGPULibrary> WebGPULibrary::create(WebGPURenderingContext& context, const String& sourceCode)
+Ref<WebGPULibrary> WebGPULibrary::create(GPULibrary&& library, const String& sourceCode)
 {
-    return adoptRef(*new WebGPULibrary(context, sourceCode));
+    return adoptRef(*new WebGPULibrary(WTFMove(library), sourceCode));
 }
 
-WebGPULibrary::WebGPULibrary(WebGPURenderingContext& context, const String& sourceCode)
-    : WebGPUObject { &context }
-    , m_sourceCode { sourceCode }
-    , m_library { context.device(), sourceCode }
+WebGPULibrary::WebGPULibrary(GPULibrary&& library, const String& sourceCode)
+    : m_sourceCode { sourceCode }
+    , m_library { WTFMove(library) }
 {
 }
 
@@ -55,7 +53,7 @@
     GPUFunction function { m_library, name };
     if (!function)
         return nullptr;
-    return WebGPUFunction::create(*context(), WTFMove(function));
+    return WebGPUFunction::create(WTFMove(function));
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/WebGPULibrary.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPULibrary.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPULibrary.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,15 +28,16 @@
 #if ENABLE(WEBGPU)
 
 #include "GPULibrary.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class WebGPUFunction;
 
-class WebGPULibrary : public WebGPUObject {
+class WebGPULibrary : public RefCounted<WebGPULibrary> {
 public:
-    static Ref<WebGPULibrary> create(WebGPURenderingContext&, const String& sourceCode);
+    static Ref<WebGPULibrary> create(GPULibrary&&, const String& sourceCode);
 
     const String& sourceCode() const { return m_sourceCode; }
 
@@ -48,7 +49,7 @@
     RefPtr<WebGPUFunction> functionWithName(const String&) const;
 
 private:
-    WebGPULibrary(WebGPURenderingContext&, const String& sourceCode);
+    WebGPULibrary(GPULibrary&&, const String& sourceCode);
 
     String m_sourceCode;
     GPULibrary m_library;

Modified: trunk/Source/WebCore/html/canvas/WebGPULibrary.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPULibrary.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPULibrary.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPULibrary {
 
     readonly attribute DOMString sourceCode;

Deleted: trunk/Source/WebCore/html/canvas/WebGPUObject.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUObject.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUObject.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2017 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. ``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.
- */
-
-#include "config.h"
-#include "WebGPUObject.h"
-
-#if ENABLE(WEBGPU)
-
-#include "WebGPURenderingContext.h"
-
-namespace WebCore {
-
-WebGPUObject::WebGPUObject(WebGPURenderingContext* context)
-    : m_context { context }
-{
-}
-
-WebGPUObject::~WebGPUObject() = default;
-
-}
-
-#endif

Deleted: trunk/Source/WebCore/html/canvas/WebGPUObject.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUObject.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUObject.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2017 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. ``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.
- */
-
-#pragma once
-
-#if ENABLE(WEBGPU)
-
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace WebCore {
-
-class WebGPURenderingContext;
-
-class WebGPUObject : public RefCounted<WebGPUObject> {
-public:
-    virtual ~WebGPUObject();
-
-    WebGPURenderingContext* context() const { return m_context.get(); }
-
-protected:
-    explicit WebGPUObject(WebGPURenderingContext* = nullptr);
-
-    bool hasContext() const { return m_context; }
-
-private:
-    RefPtr<WebGPURenderingContext> m_context;
-};
-    
-} // namespace WebCore
-
-#endif

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -35,18 +35,16 @@
 #include "WebGPUDepthStencilState.h"
 #include "WebGPURenderPassDescriptor.h"
 #include "WebGPURenderPipelineState.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
-Ref<WebGPURenderCommandEncoder> WebGPURenderCommandEncoder::create(WebGPURenderingContext& context, const GPUCommandBuffer& buffer, const GPURenderPassDescriptor& descriptor)
+Ref<WebGPURenderCommandEncoder> WebGPURenderCommandEncoder::create(GPURenderCommandEncoder&& encoder)
 {
-    return adoptRef(*new WebGPURenderCommandEncoder(context, buffer, descriptor));
+    return adoptRef(*new WebGPURenderCommandEncoder(WTFMove(encoder)));
 }
 
-WebGPURenderCommandEncoder::WebGPURenderCommandEncoder(WebGPURenderingContext& context, const GPUCommandBuffer& buffer, const GPURenderPassDescriptor& descriptor)
-    : WebGPUObject { &context }
-    , m_encoder { buffer, descriptor }
+WebGPURenderCommandEncoder::WebGPURenderCommandEncoder(GPURenderCommandEncoder&& encoder)
+    : m_encoder { WTFMove(encoder) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,18 +28,19 @@
 #if ENABLE(WEBGPU)
 
 #include "GPURenderCommandEncoder.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
+class WebGPUBuffer;
 class WebGPUDepthStencilState;
 class WebGPURenderPipelineState;
-class WebGPUBuffer;
 
-class WebGPURenderCommandEncoder : public WebGPUObject {
+class WebGPURenderCommandEncoder : public RefCounted<WebGPURenderCommandEncoder> {
 public:
-    virtual ~WebGPURenderCommandEncoder();
-    static Ref<WebGPURenderCommandEncoder> create(WebGPURenderingContext&, const GPUCommandBuffer&, const GPURenderPassDescriptor&);
+    ~WebGPURenderCommandEncoder();
+    static Ref<WebGPURenderCommandEncoder> create(GPURenderCommandEncoder&&);
 
     void setRenderPipelineState(WebGPURenderPipelineState&);
     void setDepthStencilState(WebGPUDepthStencilState&);
@@ -51,7 +52,7 @@
     GPURenderCommandEncoder& encoder() { return m_encoder; }
 
 private:
-    WebGPURenderCommandEncoder(WebGPURenderingContext&, const GPUCommandBuffer&, const GPURenderPassDescriptor&);
+    explicit WebGPURenderCommandEncoder(GPURenderCommandEncoder&&);
 
     GPURenderCommandEncoder m_encoder;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderCommandEncoder.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPURenderCommandEncoder {
 
     void setRenderPipelineState(WebGPURenderPipelineState pipelineState);

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassAttachmentDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassAttachmentDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassAttachmentDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -30,13 +30,11 @@
 
 #include "GPURenderPassAttachmentDescriptor.h"
 #include "GPUTexture.h"
-#include "WebGPURenderingContext.h"
 #include "WebGPUTexture.h"
 
 namespace WebCore {
 
-WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor(WebGPURenderingContext& context)
-    : WebGPUObject { &context }
+WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor()
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassAttachmentDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassAttachmentDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassAttachmentDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -27,7 +27,8 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
@@ -34,7 +35,7 @@
 class GPURenderPassAttachmentDescriptor;
 class WebGPUTexture;
 
-class WebGPURenderPassAttachmentDescriptor : public WebGPUObject {
+class WebGPURenderPassAttachmentDescriptor : public RefCounted<WebGPURenderPassAttachmentDescriptor> {
 public:
     virtual ~WebGPURenderPassAttachmentDescriptor();
 
@@ -50,7 +51,7 @@
     virtual bool isColorAttachmentDescriptor() const = 0;
 
 protected:
-    explicit WebGPURenderPassAttachmentDescriptor(WebGPURenderingContext&);
+    WebGPURenderPassAttachmentDescriptor();
 
 private:
     virtual const GPURenderPassAttachmentDescriptor& descriptor() const = 0;

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -29,19 +29,18 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUTexture.h"
-#include "WebGPURenderingContext.h"
 #include "WebGPUTexture.h"
+#include <wtf/Vector.h>
 
 namespace WebCore {
 
-Ref<WebGPURenderPassColorAttachmentDescriptor> WebGPURenderPassColorAttachmentDescriptor::create(WebGPURenderingContext& context, GPURenderPassColorAttachmentDescriptor&& descriptor)
+Ref<WebGPURenderPassColorAttachmentDescriptor> WebGPURenderPassColorAttachmentDescriptor::create(GPURenderPassColorAttachmentDescriptor&& descriptor)
 {
-    return adoptRef(*new WebGPURenderPassColorAttachmentDescriptor(context, WTFMove(descriptor)));
+    return adoptRef(*new WebGPURenderPassColorAttachmentDescriptor(WTFMove(descriptor)));
 }
 
-WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor(WebGPURenderingContext& context, GPURenderPassColorAttachmentDescriptor&& descriptor)
-    : WebGPURenderPassAttachmentDescriptor(context)
-    , m_descriptor(WTFMove(descriptor))
+WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor(GPURenderPassColorAttachmentDescriptor&& descriptor)
+    : m_descriptor { WTFMove(descriptor) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassColorAttachmentDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -32,16 +32,16 @@
 
 namespace WebCore {
 
-class WebGPURenderPassColorAttachmentDescriptor : public WebGPURenderPassAttachmentDescriptor {
+class WebGPURenderPassColorAttachmentDescriptor final : public WebGPURenderPassAttachmentDescriptor {
 public:
     virtual ~WebGPURenderPassColorAttachmentDescriptor();
-    static Ref<WebGPURenderPassColorAttachmentDescriptor> create(WebGPURenderingContext&, GPURenderPassColorAttachmentDescriptor&&);
+    static Ref<WebGPURenderPassColorAttachmentDescriptor> create(GPURenderPassColorAttachmentDescriptor&&);
 
     Vector<float> clearColor() const;
     void setClearColor(const Vector<float>&);
 
 private:
-    WebGPURenderPassColorAttachmentDescriptor(WebGPURenderingContext&, GPURenderPassColorAttachmentDescriptor&&);
+    explicit WebGPURenderPassColorAttachmentDescriptor(GPURenderPassColorAttachmentDescriptor&&);
 
     const GPURenderPassAttachmentDescriptor& descriptor() const final;
     bool isColorAttachmentDescriptor() const final { return true; }

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,19 +28,17 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPURenderingContext.h"
 #include "WebGPUTexture.h"
 
 namespace WebCore {
 
-Ref<WebGPURenderPassDepthAttachmentDescriptor> WebGPURenderPassDepthAttachmentDescriptor::create(WebGPURenderingContext& context, GPURenderPassDepthAttachmentDescriptor&& descriptor)
+Ref<WebGPURenderPassDepthAttachmentDescriptor> WebGPURenderPassDepthAttachmentDescriptor::create(GPURenderPassDepthAttachmentDescriptor&& descriptor)
 {
-    return adoptRef(*new WebGPURenderPassDepthAttachmentDescriptor(context, WTFMove(descriptor)));
+    return adoptRef(*new WebGPURenderPassDepthAttachmentDescriptor(WTFMove(descriptor)));
 }
 
-WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor(WebGPURenderingContext& context, GPURenderPassDepthAttachmentDescriptor&& descriptor)
-    : WebGPURenderPassAttachmentDescriptor(context)
-    , m_descriptor(WTFMove(descriptor))
+WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor(GPURenderPassDepthAttachmentDescriptor&& descriptor)
+    : m_descriptor { WTFMove(descriptor) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -35,13 +35,13 @@
 class WebGPURenderPassDepthAttachmentDescriptor final : public WebGPURenderPassAttachmentDescriptor {
 public:
     virtual ~WebGPURenderPassDepthAttachmentDescriptor();
-    static Ref<WebGPURenderPassDepthAttachmentDescriptor> create(WebGPURenderingContext&, GPURenderPassDepthAttachmentDescriptor&&);
+    static Ref<WebGPURenderPassDepthAttachmentDescriptor> create(GPURenderPassDepthAttachmentDescriptor&&);
 
     double clearDepth() const;
     void setClearDepth(double);
 
 private:
-    WebGPURenderPassDepthAttachmentDescriptor(WebGPURenderingContext&, GPURenderPassDepthAttachmentDescriptor&&);
+    explicit WebGPURenderPassDepthAttachmentDescriptor(GPURenderPassDepthAttachmentDescriptor&&);
 
     const GPURenderPassAttachmentDescriptor& descriptor() const final;
     bool isColorAttachmentDescriptor() const final { return false; }

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -42,7 +42,7 @@
 WebGPURenderPassDepthAttachmentDescriptor& WebGPURenderPassDescriptor::depthAttachment()
 {
     if (!m_depthAttachment)
-        m_depthAttachment = WebGPURenderPassDepthAttachmentDescriptor::create(*context(), m_descriptor.depthAttachment());
+        m_depthAttachment = WebGPURenderPassDepthAttachmentDescriptor::create(m_descriptor.depthAttachment());
     return *m_depthAttachment;
 }
 
@@ -53,7 +53,7 @@
         ASSERT(!attachments.isEmpty());
         m_colorAttachments.reserveInitialCapacity(attachments.size());
         for (auto& attachment : attachments)
-            m_colorAttachments.uncheckedAppend(WebGPURenderPassColorAttachmentDescriptor::create(*context(), WTFMove(attachment)));
+            m_colorAttachments.uncheckedAppend(WebGPURenderPassColorAttachmentDescriptor::create(WTFMove(attachment)));
     }
     return m_colorAttachments;
 }

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,16 +28,17 @@
 #if ENABLE(WEBGPU)
 
 #include "GPURenderPassDescriptor.h"
-#include "WebGPUObject.h"
 #include "WebGPURenderPassColorAttachmentDescriptor.h"
 #include "WebGPURenderPassDepthAttachmentDescriptor.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
 
-class WebGPURenderPassDescriptor : public WebGPUObject {
+class WebGPURenderPassDescriptor : public RefCounted<WebGPURenderPassDescriptor> {
 public:
-    virtual ~WebGPURenderPassDescriptor();
+    ~WebGPURenderPassDescriptor();
     static Ref<WebGPURenderPassDescriptor> create();
 
     WebGPURenderPassDepthAttachmentDescriptor& depthAttachment();

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPassDescriptor.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -26,7 +26,8 @@
 [
     Constructor,
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPURenderPassDescriptor {
 
     readonly attribute sequence<WebGPURenderPassColorAttachmentDescriptor> colorAttachments;

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -30,14 +30,13 @@
 
 namespace WebCore {
 
-Ref<WebGPURenderPipelineColorAttachmentDescriptor> WebGPURenderPipelineColorAttachmentDescriptor::create(WebGPURenderingContext& context, GPURenderPipelineColorAttachmentDescriptor&& descriptor)
+Ref<WebGPURenderPipelineColorAttachmentDescriptor> WebGPURenderPipelineColorAttachmentDescriptor::create(GPURenderPipelineColorAttachmentDescriptor&& descriptor)
 {
-    return adoptRef(*new WebGPURenderPipelineColorAttachmentDescriptor(context, WTFMove(descriptor)));
+    return adoptRef(*new WebGPURenderPipelineColorAttachmentDescriptor(WTFMove(descriptor)));
 }
 
-WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor(WebGPURenderingContext& context, GPURenderPipelineColorAttachmentDescriptor&& descriptor)
-    : WebGPUObject { &context }
-    , m_descriptor { WTFMove(descriptor) }
+WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor(GPURenderPipelineColorAttachmentDescriptor&& descriptor)
+    : m_descriptor { WTFMove(descriptor) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,19 +28,20 @@
 #if ENABLE(WEBGPU)
 
 #include "GPURenderPipelineColorAttachmentDescriptor.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class WebGPURenderPipelineColorAttachmentDescriptor : public WebGPUObject {
+class WebGPURenderPipelineColorAttachmentDescriptor : public RefCounted<WebGPURenderPipelineColorAttachmentDescriptor> {
 public:
-    static Ref<WebGPURenderPipelineColorAttachmentDescriptor> create(WebGPURenderingContext&, GPURenderPipelineColorAttachmentDescriptor&&);
+    static Ref<WebGPURenderPipelineColorAttachmentDescriptor> create(GPURenderPipelineColorAttachmentDescriptor&&);
 
     unsigned pixelFormat() const;
     void setPixelFormat(unsigned);
 
 private:
-    WebGPURenderPipelineColorAttachmentDescriptor(WebGPURenderingContext&, GPURenderPipelineColorAttachmentDescriptor&&);
+    explicit WebGPURenderPipelineColorAttachmentDescriptor(GPURenderPipelineColorAttachmentDescriptor&&);
 
     GPURenderPipelineColorAttachmentDescriptor m_descriptor;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPURenderPipelineColorAttachmentDescriptor {
 
     attribute unsigned long pixelFormat; // should be MTLPixelFormat

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -32,7 +32,6 @@
 #include "GPURenderPipelineColorAttachmentDescriptor.h"
 #include "WebGPUFunction.h"
 #include "WebGPURenderPipelineColorAttachmentDescriptor.h"
-#include "WebGPURenderingContext.h"
 
 namespace WebCore {
 
@@ -83,7 +82,7 @@
         auto attachments = m_descriptor.colorAttachments();
         m_colorAttachments.reserveInitialCapacity(attachments.size());
         for (auto& attachment : attachments)
-            m_colorAttachments.uncheckedAppend(WebGPURenderPipelineColorAttachmentDescriptor::create(*context(), WTFMove(attachment)));
+            m_colorAttachments.uncheckedAppend(WebGPURenderPipelineColorAttachmentDescriptor::create(WTFMove(attachment)));
     }
     return m_colorAttachments;
 }

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,8 +28,9 @@
 #if ENABLE(WEBGPU)
 
 #include "GPURenderPipelineDescriptor.h"
-#include "WebGPUObject.h"
 #include "WebGPURenderPipelineColorAttachmentDescriptor.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 
 namespace WebCore {
@@ -39,9 +40,9 @@
 class WebGPUFunction;
 class WebGPURenderPipelineColorAttachmentDescriptor;
 
-class WebGPURenderPipelineDescriptor : public WebGPUObject {
+class WebGPURenderPipelineDescriptor : public RefCounted<WebGPURenderPipelineDescriptor> {
 public:
-    virtual ~WebGPURenderPipelineDescriptor();
+    ~WebGPURenderPipelineDescriptor();
     static Ref<WebGPURenderPipelineDescriptor> create();
 
     WebGPUFunction* vertexFunction() const;

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -26,7 +26,8 @@
 [
     Constructor,
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPURenderPipelineDescriptor {
 
     attribute WebGPUFunction? vertexFunction;

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,19 +28,15 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPURenderPipelineDescriptor.h"
-#include "WebGPURenderingContext.h"
-
 namespace WebCore {
 
-Ref<WebGPURenderPipelineState> WebGPURenderPipelineState::create(WebGPURenderingContext& context, const GPURenderPipelineDescriptor& descriptor)
+Ref<WebGPURenderPipelineState> WebGPURenderPipelineState::create(GPURenderPipelineState&& state)
 {
-    return adoptRef(*new WebGPURenderPipelineState(context, descriptor));
+    return adoptRef(*new WebGPURenderPipelineState(WTFMove(state)));
 }
 
-WebGPURenderPipelineState::WebGPURenderPipelineState(WebGPURenderingContext& context, const GPURenderPipelineDescriptor& descriptor)
-    : WebGPUObject { &context }
-    , m_state { context.device(), descriptor }
+WebGPURenderPipelineState::WebGPURenderPipelineState(GPURenderPipelineState&& state)
+    : m_state { WTFMove(state) }
 {
 }
 

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,13 +28,14 @@
 #if ENABLE(WEBGPU)
 
 #include "GPURenderPipelineState.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class WebGPURenderPipelineState : public WebGPUObject {
+class WebGPURenderPipelineState : public RefCounted<WebGPURenderPipelineState> {
 public:
-    static Ref<WebGPURenderPipelineState> create(WebGPURenderingContext&, const GPURenderPipelineDescriptor&);
+    static Ref<WebGPURenderPipelineState> create(GPURenderPipelineState&&);
 
     String label() const;
     void setLabel(const String&);
@@ -42,7 +43,7 @@
     const GPURenderPipelineState& state() const { return m_state; }
 
 private:
-    WebGPURenderPipelineState(WebGPURenderingContext&, const GPURenderPipelineDescriptor&);
+    explicit WebGPURenderPipelineState(GPURenderPipelineState&&);
 
     GPURenderPipelineState m_state;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderPipelineState.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPURenderPipelineState {
 
     attribute DOMString label;

Modified: trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPURenderingContext.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -153,42 +153,42 @@
 
 Ref<WebGPULibrary> WebGPURenderingContext::createLibrary(const String& sourceCode)
 {
-    return WebGPULibrary::create(*this, sourceCode);
+    return WebGPULibrary::create(GPULibrary { m_device, sourceCode }, sourceCode);
 }
 
 Ref<WebGPURenderPipelineState> WebGPURenderingContext::createRenderPipelineState(WebGPURenderPipelineDescriptor& descriptor)
 {
-    return WebGPURenderPipelineState::create(*this, descriptor.descriptor());
+    return WebGPURenderPipelineState::create(GPURenderPipelineState { m_device, descriptor.descriptor() });
 }
 
 Ref<WebGPUDepthStencilState> WebGPURenderingContext::createDepthStencilState(WebGPUDepthStencilDescriptor& descriptor)
 {
-    return WebGPUDepthStencilState::create(*this, descriptor.descriptor());
+    return WebGPUDepthStencilState::create(GPUDepthStencilState { m_device, descriptor.descriptor() });
 }
 
 Ref<WebGPUComputePipelineState> WebGPURenderingContext::createComputePipelineState(WebGPUFunction& function)
 {
-    return WebGPUComputePipelineState::create(*this, function.function());
+    return WebGPUComputePipelineState::create(GPUComputePipelineState { m_device, function.function() });
 }
 
 Ref<WebGPUCommandQueue> WebGPURenderingContext::createCommandQueue()
 {
-    return WebGPUCommandQueue::create(*this);
+    return WebGPUCommandQueue::create(GPUCommandQueue { m_device });
 }
 
 Ref<WebGPUDrawable> WebGPURenderingContext::nextDrawable()
 {
-    return WebGPUDrawable::create(*this);
+    return WebGPUDrawable::create(GPUDrawable { m_device });
 }
 
 RefPtr<WebGPUBuffer> WebGPURenderingContext::createBuffer(JSC::ArrayBufferView& data)
 {
-    return WebGPUBuffer::create(*this, data);
+    return WebGPUBuffer::create(GPUBuffer { m_device, data });
 }
 
 Ref<WebGPUTexture> WebGPURenderingContext::createTexture(WebGPUTextureDescriptor& descriptor)
 {
-    return WebGPUTexture::create(*this, descriptor.descriptor());
+    return WebGPUTexture::create(GPUTexture { m_device, descriptor.descriptor() });
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/canvas/WebGPUTexture.cpp (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUTexture.cpp	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUTexture.cpp	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,32 +28,18 @@
 
 #if ENABLE(WEBGPU)
 
-#include "WebGPURenderingContext.h"
-
 namespace WebCore {
 
-Ref<WebGPUTexture> WebGPUTexture::createFromDrawableTexture(WebGPURenderingContext& context, GPUTexture&& texture)
+Ref<WebGPUTexture> WebGPUTexture::create(GPUTexture&& texture)
 {
-    return adoptRef(*new WebGPUTexture(context, WTFMove(texture)));
+    return adoptRef(*new WebGPUTexture(WTFMove(texture)));
 }
 
-Ref<WebGPUTexture> WebGPUTexture::create(WebGPURenderingContext& context, const GPUTextureDescriptor& descriptor)
+WebGPUTexture::WebGPUTexture(GPUTexture&& texture)
+    : m_texture { WTFMove(texture) }
 {
-    return adoptRef(*new WebGPUTexture(context, descriptor));
 }
 
-WebGPUTexture::WebGPUTexture(WebGPURenderingContext& context, GPUTexture&& texture)
-    : WebGPUObject { &context }
-    , m_texture { WTFMove(texture) }
-{
-}
-
-WebGPUTexture::WebGPUTexture(WebGPURenderingContext& context, const GPUTextureDescriptor& descriptor)
-    : WebGPUObject { &context }
-    , m_texture { context.device(), descriptor }
-{
-}
-
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/html/canvas/WebGPUTexture.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUTexture.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUTexture.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,16 +28,16 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUTexture.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class GPUTextureDescriptor;
 
-class WebGPUTexture : public WebGPUObject {
+class WebGPUTexture : public RefCounted<WebGPUTexture> {
 public:
-    static Ref<WebGPUTexture> createFromDrawableTexture(WebGPURenderingContext&, GPUTexture&&);
-    static Ref<WebGPUTexture> create(WebGPURenderingContext&, const GPUTextureDescriptor&);
+    static Ref<WebGPUTexture> create(GPUTexture&&);
 
     unsigned width() const { return m_texture.width(); }
     unsigned height() const { return m_texture.height(); }
@@ -45,8 +45,7 @@
     const GPUTexture& texture() const { return m_texture; }
 
 private:
-    WebGPUTexture(WebGPURenderingContext&, GPUTexture&&);
-    WebGPUTexture(WebGPURenderingContext&, const GPUTextureDescriptor&);
+    explicit WebGPUTexture(GPUTexture&&);
 
     GPUTexture m_texture;
 };

Modified: trunk/Source/WebCore/html/canvas/WebGPUTexture.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUTexture.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUTexture.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -25,7 +25,8 @@
 
 [
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUTexture {
 
     readonly attribute unsigned long width;

Modified: trunk/Source/WebCore/html/canvas/WebGPUTextureDescriptor.h (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUTextureDescriptor.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUTextureDescriptor.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -28,11 +28,12 @@
 #if ENABLE(WEBGPU)
 
 #include "GPUTextureDescriptor.h"
-#include "WebGPUObject.h"
+#include <wtf/Ref.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
-class WebGPUTextureDescriptor : public WebGPUObject {
+class WebGPUTextureDescriptor : public RefCounted<WebGPUTextureDescriptor> {
 public:
     static Ref<WebGPUTextureDescriptor> create(unsigned pixelFormat, unsigned width, unsigned height, bool mipmapped);
 

Modified: trunk/Source/WebCore/html/canvas/WebGPUTextureDescriptor.idl (234563 => 234564)


--- trunk/Source/WebCore/html/canvas/WebGPUTextureDescriptor.idl	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/html/canvas/WebGPUTextureDescriptor.idl	2018-08-03 23:25:56 UTC (rev 234564)
@@ -26,7 +26,8 @@
 [
     Constructor(unsigned long pixelFormat, unsigned long width, unsigned long height, boolean mipmapped),
     Conditional=WEBGPU,
-    EnabledAtRuntime=WebGPU
+    EnabledAtRuntime=WebGPU,
+    ImplementationLacksVTable
 ] interface WebGPUTextureDescriptor {
 
     attribute unsigned long textureType;

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDepthStencilState.h (234563 => 234564)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUDepthStencilState.h	2018-08-03 23:13:57 UTC (rev 234563)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDepthStencilState.h	2018-08-03 23:25:56 UTC (rev 234564)
@@ -27,6 +27,7 @@
 
 #if ENABLE(WEBGPU)
 
+#include <wtf/Forward.h>
 #include <wtf/RetainPtr.h>
 
 OBJC_PROTOCOL(MTLDepthStencilState);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to