Bug 236891

Summary: [WebGPU] Tracer bullet part 4: Move Device's construction methods to the files of the things they create
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: WebGPUAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: dino, rmorisset, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 236879, 236898, 236899    
Attachments:
Description Flags
Patch dino: review+

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>