electron/patches/chromium/preconnect_feature.patch
Electron Bot 39baf68790
chore: bump chromium to 5b340c815ce15ab2efcf277ed19e9 (master) (#22064)
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
Co-authored-by: loc <andy@slack-corp.com>
Co-authored-by: Robo <hop2deep@gmail.com>
Co-authored-by: Jeremy Apthorp <nornagon@nornagon.net>
2020-03-03 13:35:05 -08:00

69 lines
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alexey Kuts <kruntuid@gmail.com>
Date: Fri, 26 Jul 2019 22:32:54 +0300
Subject: remove references to Profile from PreconnectManager
The PreconnectManager in Chrome only depends on Profile for testing purposes;
this patch removes that dependency so we can reuse it.
Ideally we would change this class in upstream to not depend on Profile.
diff --git a/chrome/browser/predictors/preconnect_manager.cc b/chrome/browser/predictors/preconnect_manager.cc
index 50adee35887f799fea11a35eca1240851a0d1126..9935e068983de3342382f73889be41acc3fe8f4e 100644
--- a/chrome/browser/predictors/preconnect_manager.cc
+++ b/chrome/browser/predictors/preconnect_manager.cc
@@ -69,7 +69,7 @@ PreresolveJob::PreresolveJob(PreresolveJob&& other) = default;
PreresolveJob::~PreresolveJob() = default;
PreconnectManager::PreconnectManager(base::WeakPtr<Delegate> delegate,
- Profile* profile)
+ content::BrowserContext* profile)
: delegate_(std::move(delegate)),
profile_(profile),
inflight_preresolves_count_(0) {
@@ -328,11 +328,13 @@ network::mojom::NetworkContext* PreconnectManager::GetNetworkContext() const {
if (network_context_)
return network_context_;
+#if 0
if (profile_->AsTestingProfile()) {
// We're testing and |network_context_| wasn't set. Return nullptr to avoid
// hitting the network.
return nullptr;
}
+#endif
return content::BrowserContext::GetDefaultStoragePartition(profile_)
->GetNetworkContext();
diff --git a/chrome/browser/predictors/preconnect_manager.h b/chrome/browser/predictors/preconnect_manager.h
index 7c99f4543095f600a5a7705846bc01f5656a9c8d..bbd62bccef6a3c5013c5f3ee4f24443835728d44 100644
--- a/chrome/browser/predictors/preconnect_manager.h
+++ b/chrome/browser/predictors/preconnect_manager.h
@@ -22,6 +22,10 @@
class Profile;
+namespace content {
+class BrowserContext;
+}
+
namespace network {
namespace mojom {
class NetworkContext;
@@ -143,7 +147,7 @@ class PreconnectManager {
static const size_t kMaxInflightPreresolves = 3;
- PreconnectManager(base::WeakPtr<Delegate> delegate, Profile* profile);
+ PreconnectManager(base::WeakPtr<Delegate> delegate, content::BrowserContext* profile);
virtual ~PreconnectManager();
// Starts preconnect and preresolve jobs keyed by |url|.
@@ -208,7 +212,7 @@ class PreconnectManager {
network::mojom::NetworkContext* GetNetworkContext() const;
base::WeakPtr<Delegate> delegate_;
- Profile* const profile_;
+ content::BrowserContext* const profile_;
std::list<PreresolveJobId> queued_jobs_;
PreresolveJobMap preresolve_jobs_;
std::map<GURL, std::unique_ptr<PreresolveInfo>> preresolve_info_;