Skip to content

Less nesting on WebGPUResponse #32766

Closed

Description

@sagudev

Currently response sender has this type: IpcSender<Option<WebGPUResponseResult>>, where

pub type WebGPUResponseResult = Result<WebGPUResponse, String>;

Option is None only when dom.webgpu.enabled is disabled (introduced in #31002), instead we can pack None value into as WebGPUResponse::NoWebGPU variant.

Result errors only in RequestDevice or RequestAdapter in other cases we already use result in variant (we need limited errors and it's nice know which request are we resolving):

PoppedErrorScope(Result<Option<Error>, PopError>),
(or not have result/error at all). So we can remove outer Result and replacing it with results in variants (this will require named struct for all data inside:
RequestAdapter {
adapter_info: wgt::AdapterInfo,
adapter_id: WebGPUAdapter,
features: wgt::Features,
limits: wgt::Limits,
channel: WebGPU,
},
).

Does that sounds reasonable @gterzian?

Activity

  1. added
    A-content/webgpu
    on Jul 12, 2024
  2. gterzian commented on Jul 16, 2024

    @gterzian
    Member

    Does that sounds reasonable?

    Yes

  3. moved this from To do to Done in WebGPUon Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-content/webgpu

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions