69 lines
2.8 KiB
Diff
69 lines
2.8 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 c3c7d4220f7ea612e5b86645854e4f426066e18c..969dd6659bfdc0fa3cf3edf494f1623ba10134a5 100644
|
|
--- a/chrome/browser/predictors/preconnect_manager.cc
|
|
+++ b/chrome/browser/predictors/preconnect_manager.cc
|
|
@@ -70,7 +70,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) {
|
|
@@ -317,11 +317,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 e35163576b55d772098ae2a2138c4c1cf8438eac..70cad725f9476175b31859867c640ca8c66816a8 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;
|
|
@@ -138,7 +142,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|.
|
|
@@ -196,7 +200,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<std::string, std::unique_ptr<PreresolveInfo>> preresolve_info_;
|