Bug 238801 - [Unix] Adopt UnixFileDescriptor in IPC::Attachment
Summary: [Unix] Adopt UnixFileDescriptor in IPC::Attachment
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Zan Dobersek
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-05 06:06 PDT by Zan Dobersek
Modified: 2022-04-06 04:17 PDT (History)
8 users (show)

See Also:


Attachments
Patch (22.14 KB, patch)
2022-04-05 06:08 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch for landing (22.30 KB, patch)
2022-04-06 02:42 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch for landing (22.24 KB, patch)
2022-04-06 04:01 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff
Patch for landing (22.25 KB, patch)
2022-04-06 04:14 PDT, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>