Bug 224725 - Use WebProcess::existingGPUProcessConnection() whenever possible
Summary: Use WebProcess::existingGPUProcessConnection() whenever possible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-17 18:58 PDT by Chris Dumez
Modified: 2021-04-24 15:06 PDT (History)
11 users (show)

See Also:


Attachments
Patch (5.33 KB, patch)
2021-04-17 18:59 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (5.23 KB, patch)
2021-04-17 20:08 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2021-04-17 18:58:33 PDT
Use WebProcess::existingGPUProcessConnection() whenever possible, instead of WebProcess::ensureGPUProcessConnection(). This avoids relaunching the GPUProcess if it has already exited.
Comment 1 Chris Dumez 2021-04-17 18:59:54 PDT
Created attachment 426360 [details]
Patch
Comment 2 Darin Adler 2021-04-17 20:04:40 PDT
Comment on attachment 426360 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426360&action=review

> Source/WebKit/WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:58
> +    if (auto* gpuProcessConnection = WebProcess::singleton().existingGPUProcessConnection()) {

I don’t think it’s an improvement to use the multi-word name for the local variable. Yes, it’s the GPU Process connection, but the name can just be connection in such tight if statements. You may not agree, but I really prefer simple single-word names when possible, even if there is some slight ambiguity.
Comment 3 Chris Dumez 2021-04-17 20:06:01 PDT
Comment on attachment 426360 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=426360&action=review

>> Source/WebKit/WebProcess/GPU/media/RemoteAudioHardwareListener.cpp:58
>> +    if (auto* gpuProcessConnection = WebProcess::singleton().existingGPUProcessConnection()) {
> 
> I don’t think it’s an improvement to use the multi-word name for the local variable. Yes, it’s the GPU Process connection, but the name can just be connection in such tight if statements. You may not agree, but I really prefer simple single-word names when possible, even if there is some slight ambiguity.

Ok. I went this way because connection->connection() looks a bit weird. The ambiguity between IPC::Connection and GPUProcessConnection is a bit annoying.
Comment 4 Chris Dumez 2021-04-17 20:08:37 PDT
Created attachment 426362 [details]
Patch
Comment 5 Chris Dumez 2021-04-17 20:11:14 PDT
(In reply to Chris Dumez from comment #4)
> Created attachment 426362 [details]
> Patch

Renamed to "connection".
Comment 6 EWS 2021-04-17 20:41:05 PDT
Committed r276218 (236700@main): <https://commits.webkit.org/236700@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426362 [details].
Comment 7 Radar WebKit Bug Importer 2021-04-24 15:06:36 PDT
<rdar://problem/77110077>