Skip to content
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 minimal for electronjs #19952

Merged
merged 5 commits into from Aug 27, 2019

Conversation

@nornagon
Copy link
Member

nornagon commented Aug 26, 2019

Backport of #18671. See that PR for details.

Notes: Added support for HTTP preconnect resource hints.

@nornagon nornagon requested a review from electron/wg-upgrades as a code owner Aug 26, 2019
@trop trop bot mentioned this pull request Aug 26, 2019
5 of 5 tasks complete
@nornagon nornagon requested a review from electron/wg-releases Aug 26, 2019
Copy link
Member

ckerr left a comment

LGTM. Minor suggestions but nothing major.

@@ -4,6 +4,7 @@

#include "shell/browser/api/atom_api_session.h"

#include <algorithm>

This comment has been minimized.

Copy link
@ckerr

ckerr Aug 26, 2019

Member

I don't see new usage of algorithms in this PR. Is this line needed?

#define SHELL_BROWSER_RENDERER_HOST_ELECTRON_RENDER_MESSAGE_FILTER_H_

#include <string>
#include <vector>

This comment has been minimized.

Copy link
@ckerr

ckerr Aug 26, 2019

Member

Neither std::string nor std::vector appear in this header

return;
}

if (!url.is_valid() || !url.has_host() || !url.has_scheme() ||

This comment has been minimized.

Copy link
@ckerr

ckerr Aug 26, 2019

Member

!url.has_scheme() isn't necessary; !url.SchemeIsHTTPOrHTTPS() below covers it

int num_sockets,
const net::NetworkIsolationKey& network_isolation_key)
: origin(origin), num_sockets(num_sockets) {
DCHECK_GE(num_sockets, 0);

This comment has been minimized.

Copy link
@ckerr

ckerr Aug 26, 2019

Member

Session::Preconnect() uses DCHECK_GT(n, 0). Is allowing 0 here intentional?

num_sockets_to_preconnect > kMaxSocketsToPreconnect) {
args->ThrowError(
base::StringPrintf("numSocketsToPreconnect is outside range [%d,%d]",
kMinSocketsToPreconnect, kMaxSocketsToPreconnect));

This comment has been minimized.

Copy link
@ckerr

ckerr Aug 26, 2019

Member

(nit) arguably useful to dump num_sockets_to_preconnect in this printf as well

It looks like you used numSocketsToPreconnect instead of numSockets here to make the error message more readable and that is an improvement; however, someone getting this error message might shoot themselves in the foot by revising their call to use numSocketsToPreconnect. Maybe something like

"preconnect numSockets %d is outside range [%d..%d]"

#include "content/public/browser/browser_context.h"
#include "shell/browser/api/atom_api_session.h"
#include "shell/browser/atom_browser_context.h"
#include "shell/common/native_mate_converters/gurl_converter.h"

This comment has been minimized.

Copy link
@ckerr

ckerr Aug 26, 2019

Member

Some of these headers appear to be unneeded -- at a quick glance, at least <stdint.h>, "stl_util.h", "gurl_converter.h"

@ckerr

This comment has been minimized.

Copy link
Member

ckerr commented Aug 26, 2019

Ah I didn't see that this was a backport, nvm 🥇

Copy link
Member

ckerr left a comment

FTBFS


../../electron/shell/browser/renderer_host/electron_render_message_filter.cc:86:20: error: out-of-line definition of 'PreconnectRequest' does not match any declaration in 'predictors::PreconnectRequest'
PreconnectRequest::PreconnectRequest(
                   ^~~~~~~~~~~~~~~~~
../../chrome/browser/predictors/resource_prefetch_predictor.h:68:21: note: type of 3rd parameter of member declaration does not match definition ('net::NetworkIsolationKey' vs 'const net::NetworkIsolationKey &')
                    net::NetworkIsolationKey network_isolation_key =
                    ^
In file included from ../../electron/shell/browser/renderer_host/electron_render_message_filter.cc:18:
In file included from ../../components/network_hints/common/network_hints_messages.h:10:
In file included from ../../ipc/ipc_message_macros.h:205:
In file included from ../../ipc/ipc_message_templates.h:16:
../../base/tuple.h:52:60: error: too few arguments to function call, expected 4, have 3
  (obj->*method)(std::get<Ns>(std::forward<Tuple>(args))...);
@ckerr ckerr dismissed their stale review Aug 26, 2019

removing approval pending wg-releases approval for this to land in 7-0-x

@ckerr
ckerr approved these changes Aug 27, 2019
Copy link
Member

ckerr left a comment

#wg-releases vote passed with none opposed

@ckerr ckerr merged commit b09a1c7 into 7-0-x Aug 27, 2019
14 checks passed
14 checks passed
Artifact Comparison Changes Detected
Details
Semantic Pull Request ready to be squashed
Details
Valid Backport Valid Backport
Details
WIP Ready for review
Details
appveyor: win-ia32-testing AppVeyor build succeeded
Details
appveyor: win-ia32-testing-pr AppVeyor build succeeded
Details
appveyor: win-x64-testing AppVeyor build succeeded
Details
appveyor: win-x64-testing-pr AppVeyor build succeeded
Details
build-linux Workflow: build-linux
Details
build-mac Workflow: build-mac
Details
electron-arm-testing Build #20190826.51 succeeded
Details
electron-arm64-testing Build #20190826.52 succeeded
Details
lint Workflow: lint
Details
release-notes Release notes found
@release-clerk

This comment has been minimized.

Copy link

release-clerk bot commented Aug 27, 2019

Release Notes Persisted

Added support for HTTP preconnect resource hints.

@ckerr ckerr deleted the backport/7-0-x/http-preconnect branch Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.