electron/patches/chromium/preconnect_manager.patch
electron-roller[bot] ea6f873f97
chore: bump chromium to 109.0.5382.0 (main) (#36057)
* chore: bump chromium in DEPS to 109.0.5364.0

* chore: update patches

* chore: bump chromium in DEPS to 109.0.5366.0

* chore: update patches

* i3940364: Change PermissionType::WINDOW_PLACEMENT to WINDOW_MANAGEMENT

https://chromium-review.googlesource.com/c/chromium/src/+/3940364

* 3866812: Change content::PluginList to only run on the UI thread.

https://chromium-review.googlesource.com/c/chromium/src/+/3866812

* chore: bump chromium in DEPS to 109.0.5368.0

* [cleanup] Replace enable_basic_printing with enable_printing

https://chromium-review.googlesource.com/c/chromium/src/+/3957357

* chore: update patches

* 3956318: Desktop PWAs: Retire kWebAppWindowControlsOverlay flag

https://chromium-review.googlesource.com/c/chromium/src/+/3956318

* fixup! Change content::PluginList to only run on the UI thread.

(cherry picked from commit 7b5ec87d4ff5d34e7493b4fb46c40c0afeef2005)
Co-Authored-By: Robo <hop2deep@gmail.com>

* chore: bump chromium in DEPS to 109.0.5370.0

* 3956299: Quota: Cleanup QuotaPermissionContext

https://chromium-review.googlesource.com/c/chromium/src/+/3956299

* chore: update patches

* 3803867: Add Mojo interface to parse XML for OOP printer capabilities

https://chromium-review.googlesource.com/c/chromium/src/+/3803867

* fixup: Add Mojo interface to parse XML for OOP printer capabilities

* chore: bump chromium in DEPS to 109.0.5372.0

* chore: update patches

* chore: bump chromium in DEPS to 109.0.5374.0

* chore: bump chromium in DEPS to 109.0.5376.0

* chore: bump chromium in DEPS to 109.0.5378.0

* chore: update patches

* Quota: Cleanup kPersistent in BrowsingDataRemover

https://chromium-review.googlesource.com/c/chromium/src/+/3964859

* 3955976: serial: Create DOMException with V8ThrowDOMException

https://chromium-review.googlesource.com/c/chromium/src/+/3955976

* 3758405: Append trailer data to serialized messages.

https://chromium-review.googlesource.com/c/chromium/src/+/3758405

* chore: revert clang roll

This patch reverts https://chromium-review.googlesource.com/c/chromium/src/+/3967491
because that roll breaks the WOA build: https://crbug.com/1377819

* chore: update patches

* chore: bump chromium in DEPS to 109.0.5380.0

* chore: update patches

* 3859750: [linux/wayland] Added plumbing for the state of tiled edges.

https://chromium-review.googlesource.com/c/chromium/src/+/3859750

Also 3970920: [linux/wayland] Fixed the tiled edges for the GTK frame.

https://chromium-review.googlesource.com/c/chromium/src/+/3970920

* chore: bump chromium in DEPS to 109.0.5382.0

* chore: update patches

* chore: revert Use accessibility.pkey when setting page access.

https://chromium-review.googlesource.com/c/chromium/src/+/3949281
breaks our Linux builds run under Docker.

This patch should be removed once
https://chromium-review.googlesource.com/c/chromium/src/+/3949284
is merged.

* 3976312: Roll clang llvmorg-16-init-8189-g97196a2d-2 : llvmorg-16-init-8697-g60809cd2-1

https://chromium-review.googlesource.com/c/chromium/src/+/3976312

* 3967841: [heap] Remove AllocationSpace::MAP_SPACE enum constant

https://chromium-review.googlesource.com/c/v8/v8/+/3967841

* 3956131: [cleanup] Remove flag for Wasm threads & atomics

https://chromium-review.googlesource.com/c/v8/v8/+/3956131

* chore: update docs for Quota: Cleanup kPersistent in BrowsingDataRemover

https://chromium-review.googlesource.com/c/chromium/src/+/3964859

* test: fixup HID test for ARM CI

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: electron-patch-conflict-fixer[bot] <83340002+electron-patch-conflict-fixer[bot]@users.noreply.github.com>
2022-10-27 12:37:04 -04:00

107 lines
4.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: deepak1556 <hop2deep@gmail.com>
Date: Thu, 13 Oct 2022 20:30:12 +0900
Subject: Preconnect manager
* Patch disables the profile related changes added in
https://chromium-review.googlesource.com/c/chromium/src/+/3928470.
* Also avoids including chrome/browser/predictors/resource_prefetch_predictor.h
in favor of defining PreconnectRequest in this file since we don't build
the header.
diff --git a/chrome/browser/predictors/preconnect_manager.cc b/chrome/browser/predictors/preconnect_manager.cc
index 48b500a8ead699ef9d30d3219f41a913711bc4a0..f3e9c87c5ce29a4e9dc8204413f47a761408a373 100644
--- a/chrome/browser/predictors/preconnect_manager.cc
+++ b/chrome/browser/predictors/preconnect_manager.cc
@@ -10,9 +10,11 @@
#include "base/containers/adapters.h"
#include "base/metrics/histogram_macros.h"
#include "base/trace_event/trace_event.h"
+#if 0
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "chrome/browser/prefetch/prefetch_prefs.h"
#include "chrome/browser/profiles/profile.h"
+#endif
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -23,6 +25,20 @@ namespace predictors {
const bool kAllowCredentialsOnPreconnectByDefault = true;
+// NOTE(nornagon): this is copied from
+// //chrome/browser/predictors/resource_prefetch_predictor.cc we don't need
+// anything in that file other than this constructor.
+PreconnectRequest::PreconnectRequest(
+ const url::Origin& origin,
+ int num_sockets,
+ const net::NetworkAnonymizationKey& network_anonymization_key)
+ : origin(origin),
+ num_sockets(num_sockets),
+ network_anonymization_key(network_anonymization_key) {
+ DCHECK_GE(num_sockets, 0);
+ DCHECK(!network_anonymization_key.IsEmpty());
+}
+
PreconnectedRequestStats::PreconnectedRequestStats(const url::Origin& origin,
bool was_preconnected)
: origin(origin), was_preconnected(was_preconnected) {}
@@ -83,11 +99,14 @@ PreconnectManager::PreconnectManager(base::WeakPtr<Delegate> delegate,
PreconnectManager::~PreconnectManager() = default;
bool PreconnectManager::IsEnabled() {
+#if 0
Profile* profile = Profile::FromBrowserContext(browser_context_);
if (!profile) {
return false;
}
return prefetch::IsSomePreloadingEnabled(*profile->GetPrefs());
+#endif
+ return true;
}
void PreconnectManager::Start(const GURL& url,
diff --git a/chrome/browser/predictors/preconnect_manager.h b/chrome/browser/predictors/preconnect_manager.h
index 9b89c3a93b68596d7a89d5cd8e10dc5e9126c2c4..968e8ac012af57ae48a6f9a26ee228938d969876 100644
--- a/chrome/browser/predictors/preconnect_manager.h
+++ b/chrome/browser/predictors/preconnect_manager.h
@@ -18,7 +18,9 @@
#include "base/time/time.h"
#include "chrome/browser/predictors/proxy_lookup_client_impl.h"
#include "chrome/browser/predictors/resolve_host_client_impl.h"
+#if 0
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
+#endif
#include "net/base/network_anonymization_key.h"
#include "url/gurl.h"
@@ -34,7 +36,28 @@ class NetworkContext;
namespace predictors {
-struct PreconnectRequest;
+// Stores all values needed to trigger a preconnect/preresolve job to a single
+// origin.
+struct PreconnectRequest {
+ // |network_anonymization_key| specifies the key that network requests for the
+ // preconnected URL are expected to use. If a request is issued with a
+ // different key, it may not use the preconnected socket. It has no effect
+ // when |num_sockets| == 0.
+ PreconnectRequest(
+ const url::Origin& origin,
+ int num_sockets,
+ const net::NetworkAnonymizationKey& network_anonymization_key);
+ PreconnectRequest(const PreconnectRequest&) = default;
+ PreconnectRequest(PreconnectRequest&&) = default;
+ PreconnectRequest& operator=(const PreconnectRequest&) = default;
+ PreconnectRequest& operator=(PreconnectRequest&&) = default;
+
+ url::Origin origin;
+ // A zero-value means that we need to preresolve a host only.
+ int num_sockets = 0;
+ bool allow_credentials = true;
+ net::NetworkAnonymizationKey network_anonymization_key;
+};
struct PreconnectedRequestStats {
PreconnectedRequestStats(const url::Origin& origin, bool was_preconnected);