WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
205011
Make preconnectTo()'s completionHandler optional
https://bugs.webkit.org/show_bug.cgi?id=205011
Summary
Make preconnectTo()'s completionHandler optional
Chris Dumez
Reported
2019-12-09 08:12:09 PST
Make preconnectTo()'s completionHandler optional, so that the network process does not unnecessarily send an IPC back if the client is not interested.
Attachments
Patch
(9.24 KB, patch)
2019-12-09 08:13 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(9.46 KB, patch)
2019-12-09 14:05 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Patch
(9.79 KB, patch)
2019-12-09 16:03 PST
,
Chris Dumez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2019-12-09 08:13:07 PST
Created
attachment 385149
[details]
Patch
Chris Dumez
Comment 2
2019-12-09 14:05:34 PST
Created
attachment 385189
[details]
Patch
Darin Adler
Comment 3
2019-12-09 15:20:12 PST
Comment on
attachment 385149
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=385149&action=review
> Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:191 > + void preconnectTo(Optional<uint64_t>&& preconnectionIdentifier, NetworkResourceLoadParameters&&);
Seems like overkill to use an rvalue reference for an Optional. Just pass by value maybe?
Chris Dumez
Comment 4
2019-12-09 15:21:49 PST
(In reply to Darin Adler from
comment #3
)
> Comment on
attachment 385149
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=385149&action=review
> > > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:191 > > + void preconnectTo(Optional<uint64_t>&& preconnectionIdentifier, NetworkResourceLoadParameters&&); > > Seems like overkill to use an rvalue reference for an Optional. Just pass by > value maybe?
I thought our policy was 'pass by value' only if <= 64 bit because it is faster. Do I remember wrong?
Darin Adler
Comment 5
2019-12-09 15:30:23 PST
Comment on
attachment 385149
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=385149&action=review
>>> Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:191 >>> + void preconnectTo(Optional<uint64_t>&& preconnectionIdentifier, NetworkResourceLoadParameters&&); >> >> Seems like overkill to use an rvalue reference for an Optional. Just pass by value maybe? > > I thought our policy was 'pass by value' only if <= 64 bit because it is faster. Do I remember wrong?
Anders told me a long time ago that passing StringView by value was faster than by reference. I never questioned that or tested it.
Chris Dumez
Comment 6
2019-12-09 16:03:34 PST
Created
attachment 385199
[details]
Patch
Chris Dumez
Comment 7
2019-12-10 08:13:10 PST
Comment on
attachment 385199
[details]
Patch Clearing flags on attachment: 385199 Committed
r253325
: <
https://trac.webkit.org/changeset/253325
>
Chris Dumez
Comment 8
2019-12-10 08:13:11 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2019-12-10 08:14:43 PST
<
rdar://problem/57794165
>
Charlie Turner
Comment 10
2020-03-18 05:29:33 PDT
Comment on
attachment 385199
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=385199&action=review
> Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:669 > + Optional<uint64_t> preconnectionIdentifier;
I'm not on a platform where I can test preconnection logic (!ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) && !ENABLE(SERVER_PRECONNECT)), but could we avoid the .send(...) at the bottom of this function if (!preconnectionIdentifier) ? I'm getting many internal errors thrown to stderr without extra information in NetworkConnectionToWebProcess::preconnectTo due to the internalError being called because of the network process side of preconnectTo being essentially a no-op on my platform. I could flag-off the call directly in preconnectTo, but reading the callsites it looked like maybe the IPC send could be avoided all-together in this case.
Chris Dumez
Comment 11
2020-03-18 08:35:12 PDT
(In reply to Charlie Turner from
comment #10
)
> Comment on
attachment 385199
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=385199&action=review
> > > Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:669 > > + Optional<uint64_t> preconnectionIdentifier; > > I'm not on a platform where I can test preconnection logic > (!ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) && !ENABLE(SERVER_PRECONNECT)), but > could we avoid the .send(...) at the bottom of this function if > (!preconnectionIdentifier) ? I'm getting many internal errors thrown to > stderr without extra information in > NetworkConnectionToWebProcess::preconnectTo due to the internalError being > called because of the network process side of preconnectTo being essentially > a no-op on my platform. I could flag-off the call directly in preconnectTo, > but reading the callsites it looked like maybe the IPC send could be avoided > all-together in this case.
If your port does not support preconnect, then yes, avoiding sending out the IPC is a good idea. If you write a patch for this, I'd be happy to review it. That said, it may not be a lot of work to add preconnect support for your port? :) Preconnect is a very useful optimization that WebKit is using more and more.
Charlie Turner
Comment 12
2020-03-20 09:29:00 PDT
(In reply to Chris Dumez from
comment #11
)
> If your port does not support preconnect, then yes, avoiding sending out the > IPC is a good idea. If you write a patch for this, I'd be happy to review > it. That said, it may not be a lot of work to add preconnect support for > your port? :) Preconnect is a very useful optimization that WebKit is using > more and more.
I'll pass that on, thanks! It turned out that this spurious error and the extra send() is already correctly avoided in trunk, being correctly conditioned out on the linkPreconnectEnabled web setting. In the WebKitGTK 2.28 release WebPage::loadRequest was calling preconnectTo outside of such a condition, which gave the errors. Sorry for not spotting master vs 2.28 difference earlier, but at least the question served a reminder we should implement preconnect hint. :)
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