-
Notifications
You must be signed in to change notification settings - Fork 15k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: HTTP preconnect feature for electronjs #17487
Conversation
💖 Thanks for opening this pull request! 💖 We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of commit messages with semantic prefixes:
Things that will help get your PR across the finish line:
We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can. |
cc @deepak1556 @zcbenz for the network related changes, may conflict with ongoing network service refactor |
@MarshallOfSound can you explain how would that conflict? Is this feature being worked on? |
@coderReview I don't think anyone else is working on preconnect specifically but their is some pretty heft refactoring going on to enable the Network Service inside Electron. Refs: #17431 for part 1 Just want to run it by @deepak1556 and @zcbenz that these two pieces of work won't conflict when one is merged. Depending on what they think it might make sense for this preconnect work to be rebased on top of their network service work. I'll leave that up to them as I'm not clear on the network service work being done |
Added HTTP Preconnect final solution
hi @MarshallOfSound made some new commits with a working version. I will provide also another repo with test cases ASAP. |
Fix build issues
hello @MarshallOfSound we have created some tests cases for the changes made. Please check here https://github.com/krunt/electron-preconnect-test-cases. Also, can you please help to pass all checks? They seem to pass but fail at the end (doing cleanup?) Thank you |
Merge master and fix issues
hello @MarshallOfSound, @deepak1556 and @zcbenz. I saw that #17431 was merged. @krunt can you check if after the Merge the code is still working as expected for pre-connect? thanks |
@krunt also please fix the merge conflicts. |
#include "chrome/browser/predictors/loading_predictor.h" | ||
#include "chrome/browser/predictors/loading_predictor_factory.h" | ||
#include "chrome/browser/predictors/preconnect_manager.h" | ||
#include "chrome/browser/profiles/profile.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we pulling in chromium profile/profile manager? Couldn't this be done without pulling this in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krunt can you answer the question above? Can we remove those files? thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
profile manager is not needed. I will remove it.
profile class declaration is needed in several places in chrome/browser/*
I tried to minimize related changes of chrome/browser/* and their interfaces.
actually I am not creating Profile class instances, just cast content::BrowserContext to Profile
(as done in Profile::FromBrowserContext()) and pass to methods where profile is needed (checking for sure that is will be safe)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkleinsc kindly check the code again. Thank you
Removed un-needed include. Merger master branch.
@zcbenz can we get some input on if and how this conflicts with your network refactoring? |
Since the preconnect feature is mostly implemented in Chromium, it won't have conflicts with NetworkService refactoring. |
@lukeapage I don't know exactly why the builds are failing. We will investigate further. Any help would be appreciated. @krunt can you confirm that @zcbenz thank you for the input. |
Fix build and merge conflicts.
Fix test issues
@lukeapage is there any way to restart the checks? I think there was some timeout issues that prevented them from running correctly. Thank you |
Merge from master branch
Merged with master and submitted again. Thanks |
@lukeapage @MarshallOfSound could you please indicate if we are still missing something in the PR?Thank you. |
We have only 2 failing checks: Mac check failure:
And ia32 failure:
Is this some known issue of the test environment? Thank you. |
The windows failure is known, the macos failure is a crash though which I haven't seen before |
Hi @MarshallOfSound thank you for your response. They seem to behave more or less the same. Would this be an issue to accepting the PR? |
@coderReview The macOS failure would require a bit of investigation as to whether this PR caused it. The failure is this. I'll rerun those tests
|
@MarshallOfSound I think that is expected. The issues seems to be this:
|
Hello, I wonder if there is something blocking this PR as we didn't have any feedback. Thank you very much. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, sorry I'm just getting around to reviewing this PR, but I don't think we can accept a 900-line patch without a plan for upstreaming. Maintaining that size of a patch is more maintenance burden than this feature is worth.
I'd recommend that you take a shot at upstreaming changes to Chromium such that we can reuse this code without a large patch. See here for info about contributing a change to Chromium.
@nornagon We need to use only part of the chromium code, so most of the patch is to remove code. Pushing that to chromium src code won't be accepted as we are removing many functionalities that are specific to browsers and not applicable to Electron (one example is profile support). Is it acceptable that we add code to |
Copying the code into I don't mean that you should upstream the patch as-is. See if you can refactor your patch so that it extracts the code you care about in such a way that it supports both Chrome and Electron's usages, and upstream that patch. |
Hi @nornagon I think we fall into your second category Do you think chromium team will accept a code that won't be used in chromium but only in Electron? Thank you for the support and review. |
It looks like there's a lot of logic in the ~10 files you're patching that would need to be copied over. If you can work out a way to only re-create logic that's entirely different, with very little or no duplication between Electron's copy and the original in Chrome, then I think that would be worthwhile. Ultimately, what we need to consider is that:
I'm unfortunately not well-enough equipped with knowledge about this particular feature to offer guidance on the best way to approach a refactor in upstream, but Electron's upgrades team can't accept features that will add substantially to the maintenance burden. We're only a few people compared with the 1000+ engineers that are changing Chromium and causing conflicts for us, and we need to pick our battles carefully. |
hello @nornagon @MarshallOfSound we have created a new PR with a different approach without the Chromium patch. We decided to create a different PR because of some conflicts. Please check it here #18671 |
Description of Change
Added HTTP preconnect hint support.
Using the parameter
numSocketsToPreconnect
in BrowserWindow you can control how many sockets will be open.Related to issue #16476.
Checklist
npm test
passesRelease Notes
Notes: Added HTTP preconnect hint support