Bug 238801

Summary: [Unix] Adopt UnixFileDescriptor in IPC::Attachment
Product: WebKit Reporter: Zan Dobersek <zan>
Component: New BugsAssignee: Zan Dobersek <zan>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, cgarcia, ews-watchlist, hi, joepeck, pangle, webkit-bug-importer, zdobersek
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=238726
Attachments:
Description Flags
Patch
none
Patch for landing
none
Patch for landing
none
Patch for landing none

Description Zan Dobersek 2022-04-05 06:06:53 PDT
[Unix] Adopt UnixFileDescriptor in IPC::Attachment
Comment 1 Zan Dobersek 2022-04-05 06:08:16 PDT
Created attachment 456697 [details]
Patch
Comment 2 Carlos Garcia Campos 2022-04-06 00:39:12 PDT
Comment on attachment 456697 [details]
Patch

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

It seems there's a caller missing in GTK.

> Source/WebKit/Platform/IPC/unix/ConnectionUnix.cpp:520
> +                if (!!attachments[i].fd()) {

I think it's worth adding Attachment::isValid() or isNull() or bool operator
Comment 3 Zan Dobersek 2022-04-06 02:42:06 PDT
Created attachment 456796 [details]
Patch for landing
Comment 4 Carlos Garcia Campos 2022-04-06 03:35:19 PDT
Comment on attachment 456796 [details]
Patch for landing

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

> Source/WebKit/Shared/glib/UserMessage.cpp:94
> -            if (g_unix_fd_list_append(result.fileDescriptors.get(), attachment.releaseFileDescriptor(), nullptr) == -1)
> +            if (g_unix_fd_list_append(result.fileDescriptors.get(), attachment.fd().release(), nullptr) == -1)

Now that I see this again, I find a bit weird that the returned fd that it's still owned by the attachment can be released. Could we remove the non const getter and make attachment.release().release() instead? or maybe keep the releaseFileDescriptor() method in attachment that returns m_fd.release() instead?
Comment 5 Zan Dobersek 2022-04-06 04:01:01 PDT
Created attachment 456801 [details]
Patch for landing

Less getters, more releasing.
Comment 6 Zan Dobersek 2022-04-06 04:14:33 PDT
Created attachment 456806 [details]
Patch for landing

Fixed the reviewed-by line.
Comment 7 Zan Dobersek (Reviews) 2022-04-06 04:16:38 PDT
Comment on attachment 456806 [details]
Patch for landing

Clearing flags on attachment: 456806

Committed r292458 (249309@trunk): <https://commits.webkit.org/249309@trunk>
Comment 8 Zan Dobersek (Reviews) 2022-04-06 04:16:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2022-04-06 04:17:16 PDT
<rdar://problem/91346350>