[webkit-changes] [WebKit/WebKit] bb2dde: [WebGPU] [Style] Lambdas in PAL/WebGPU capture mor...
Myles C. Maxfield
noreply at github.com
Sun May 21 18:16:03 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bb2ddeb3d448c9b441e27b7e86dafc0657511bb6
https://github.com/WebKit/WebKit/commit/bb2ddeb3d448c9b441e27b7e86dafc0657511bb6
Author: Myles C. Maxfield <mmaxfield at apple.com>
Date: 2023-05-21 (Sun, 21 May 2023)
Changed paths:
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUCompositorIntegrationImpl.cpp
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUConvertToBackingContext.cpp
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUQueueImpl.cpp
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPURenderPassEncoderImpl.cpp
M Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUTextureImpl.cpp
Log Message:
-----------
[WebGPU] [Style] Lambdas in PAL/WebGPU capture more than they should and don't have correct whitespacing
https://bugs.webkit.org/show_bug.cgi?id=257064
rdar://109589314
Reviewed by Dan Glastonbury.
This patch doesn't have any behavior change - it's just about style.
I generally try to avoid capturing "this" in a lambda, as:
1. Lambdas don't usually need all the member variables inside "this", and it's always good to limit
the scope of what's available
2. Depending on how the object is owned (RefPtr, unique_ptr, etc.), naively capturing "this" might
lead to a UAF or a retain cycle, if you do it wrong.
This patch removes most of the uses of capturing "this" inside PAL/WebGPU.
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUAdapterImpl.cpp:
(PAL::WebGPU::AdapterImpl::requestDevice):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUCompositorIntegrationImpl.cpp:
(PAL::WebGPU::CompositorIntegrationImpl::recreateRenderBuffers):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUConvertToBackingContext.cpp:
(PAL::WebGPU::ConvertToBackingContext::convertToBacking):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUDeviceImpl.cpp:
(PAL::WebGPU::DeviceImpl::createTexture):
(PAL::WebGPU::DeviceImpl::createBindGroupLayout):
(PAL::WebGPU::DeviceImpl::createPipelineLayout):
(PAL::WebGPU::DeviceImpl::createBindGroup):
(PAL::WebGPU::DeviceImpl::createShaderModule):
(PAL::WebGPU::convertToBacking):
(PAL::WebGPU::DeviceImpl::createComputePipeline):
(PAL::WebGPU::DeviceImpl::createRenderPipeline):
(PAL::WebGPU::DeviceImpl::createComputePipelineAsync):
(PAL::WebGPU::DeviceImpl::createRenderPipelineAsync):
(PAL::WebGPU::DeviceImpl::createRenderBundleEncoder):
(PAL::WebGPU::DeviceImpl::resolveDeviceLostPromise):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUQueueImpl.cpp:
(PAL::WebGPU::QueueImpl::submit):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPURenderPassEncoderImpl.cpp:
(PAL::WebGPU::RenderPassEncoderImpl::executeBundles):
* Source/WebCore/PAL/pal/graphics/WebGPU/Impl/WebGPUTextureImpl.cpp:
(PAL::WebGPU::TextureImpl::createView):
Canonical link: https://commits.webkit.org/264308@main
More information about the webkit-changes
mailing list