WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 222992
Use UniqueRef<> instead of std::unique_ptr<> when passing IPC::Encoder to sendMessage()
https://bugs.webkit.org/show_bug.cgi?id=222992
Summary
Use UniqueRef<> instead of std::unique_ptr<> when passing IPC::Encoder to sen...
Chris Dumez
Reported
2021-03-09 14:25:40 PST
Use UniqueRef<> instead of std::unique_ptr<> when passing IPC::Encoder to sendMessage(), to make it clear it cannot be null.
Attachments
Patch
(42.61 KB, patch)
2021-03-09 14:40 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(167.16 KB, patch)
2021-03-09 15:52 PST
,
Chris Dumez
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Patch
(167.20 KB, patch)
2021-03-09 16:02 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(167.43 KB, patch)
2021-03-09 17:06 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(167.43 KB, patch)
2021-03-09 17:08 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2021-03-09 14:40:07 PST
Created
attachment 422761
[details]
Patch
Chris Dumez
Comment 2
2021-03-09 15:52:07 PST
Created
attachment 422771
[details]
Patch
Chris Dumez
Comment 3
2021-03-09 16:02:09 PST
Created
attachment 422774
[details]
Patch
Alex Christensen
Comment 4
2021-03-09 16:55:55 PST
Comment on
attachment 422774
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=422774&action=review
> Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:-637 > - replyEncoder.reset();
There are two of these. Why don't you remove both of them?
> Source/WebKit/NetworkProcess/WebStorage/StorageManagerSet.h:75 > + bool didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, UniqueRef<IPC::Encoder>& replyEncoder);
We should probably use UniqueRef<>&& and move the ownership. It would be worth putting in the change log that we need to return a boolean because we are not checking the null status of the unique_ptr any more.
Chris Dumez
Comment 5
2021-03-09 17:01:13 PST
Comment on
attachment 422774
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=422774&action=review
>> Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:-637 >> - replyEncoder.reset(); > > There are two of these. Why don't you remove both of them?
Those of these? I don't see any other replyEncoder.reset() in this function. If there was, I don't think it would build because UniqueRef::reset() is not a think AFAIK. I must be misunderstanding your comment?
>> Source/WebKit/NetworkProcess/WebStorage/StorageManagerSet.h:75 >> + bool didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, UniqueRef<IPC::Encoder>& replyEncoder); > > We should probably use UniqueRef<>&& and move the ownership. > It would be worth putting in the change log that we need to return a boolean because we are not checking the null status of the unique_ptr any more.
I will clarify the ChangeLog. The result I used a reference instead of a rvalue-reference is that the call site would look really scary with a r-value reference: if (didReceiveSyncMessage(connection, decoder, WTFMove(encoder)) return; // Use encoder here. I get that it would work since WTFMove() is just a cast. But it looks scary so I am not sure I want to make that change. WDYT?
Alex Christensen
Comment 6
2021-03-09 17:03:44 PST
Comment on
attachment 422774
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=422774&action=review
>>> Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:-637 >>> - replyEncoder.reset(); >> >> There are two of these. Why don't you remove both of them? > > Those of these? I don't see any other replyEncoder.reset() in this function. If there was, I don't think it would build because UniqueRef::reset() is not a think AFAIK. > I must be misunderstanding your comment?
The Messages::RemoteGraphicsContextGL::messageReceiverName code for decoders does something like this too. Never mind.
Chris Dumez
Comment 7
2021-03-09 17:06:17 PST
Created
attachment 422780
[details]
Patch
Chris Dumez
Comment 8
2021-03-09 17:08:13 PST
Created
attachment 422781
[details]
Patch
EWS
Comment 9
2021-03-09 18:21:49 PST
Committed
r274189
: <
https://commits.webkit.org/r274189
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 422781
[details]
.
Radar WebKit Bug Importer
Comment 10
2021-03-09 18:22:19 PST
<
rdar://problem/75244991
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug