Bug 236891 - [WebGPU] Tracer bullet part 4: Move Device's construction methods to the files of the things they create
Summary: [WebGPU] Tracer bullet part 4: Move Device's construction methods to the file...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks: 236879 236898 236899
  Show dependency treegraph
 
Reported: 2022-02-19 13:34 PST by Myles C. Maxfield
Modified: 2022-02-21 11:24 PST (History)
3 users (show)

See Also:


Attachments
Patch (14.14 KB, patch)
2022-02-19 13:36 PST, Myles C. Maxfield
dino: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2022-02-19 13:34:32 PST
Device is kind of a factory object, and has lots of methods which create other objects in the API. To avoid Device.cpp becoming a catch-all place for tons of unrelated creation routines, this patch moves the routine that creates an X into X.mm.
Comment 1 Myles C. Maxfield 2022-02-19 13:36:09 PST
Created attachment 452654 [details]
Patch
Comment 2 Dean Jackson 2022-02-21 09:22:35 PST
Comment on attachment 452654 [details]
Patch

I'm not sure this is any better. Now one needs to remember that Device::create methods are not in Device.mm. But either way is fine.
Comment 3 Myles C. Maxfield 2022-02-21 11:00:08 PST
(In reply to Dean Jackson from comment #2)
> Comment on attachment 452654 [details]
> Patch
> 
> I'm not sure this is any better. Now one needs to remember that
> Device::create methods are not in Device.mm. But either way is fine.

Yeah. I think the principle here is "keep related concepts together." The creation routines deal deeply with the guts of the objects they create, so I figure that code should be close to the rest of the routines in the objects.
Comment 4 Myles C. Maxfield 2022-02-21 11:23:45 PST
Committed r290255 (?): <https://commits.webkit.org/r290255>
Comment 5 Radar WebKit Bug Importer 2022-02-21 11:24:19 PST
<rdar://problem/89247272>