#include "chrome/browser/predictors/preconnect_manager.h"
#include <utility>
#include "base/containers/adapters.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_macros.h"
#include "base/not_fatal_until.h"
#include "base/trace_event/trace_event.h"
#include "chrome/browser/predictors/predictors_features.h"
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "chrome/browser/preloading/preloading_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/storage_partition.h"
#include "services/network/public/mojom/network_context.mojom.h"
namespace predictors {
const bool kAllowCredentialsOnPreconnectByDefault = …;
PreconnectedRequestStats::PreconnectedRequestStats(const url::Origin& origin,
bool was_preconnected)
: … { … }
PreconnectedRequestStats::PreconnectedRequestStats(
const PreconnectedRequestStats& other) = default;
PreconnectedRequestStats::~PreconnectedRequestStats() = default;
PreconnectStats::PreconnectStats(const GURL& url)
: … { … }
PreconnectStats::~PreconnectStats() = default;
PreresolveInfo::PreresolveInfo(const GURL& url, size_t count)
: … { … }
PreresolveInfo::~PreresolveInfo() = default;
PreresolveJob::PreresolveJob(
const GURL& url,
int num_sockets,
bool allow_credentials,
net::NetworkAnonymizationKey network_anonymization_key,
PreresolveInfo* info)
: … { … }
PreresolveJob::PreresolveJob(PreconnectRequest preconnect_request,
PreresolveInfo* info)
: … { … }
PreresolveJob::PreresolveJob(PreresolveJob&& other) = default;
PreresolveJob::~PreresolveJob() = default;
PreconnectManager::PreconnectManager(base::WeakPtr<Delegate> delegate,
content::BrowserContext* browser_context)
: … { … }
PreconnectManager::~PreconnectManager() = default;
bool PreconnectManager::IsEnabled() { … }
void PreconnectManager::Start(const GURL& url,
std::vector<PreconnectRequest> requests) { … }
void PreconnectManager::StartPreresolveHost(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key) { … }
void PreconnectManager::StartPreresolveHosts(
const std::vector<GURL>& urls,
const net::NetworkAnonymizationKey& network_anonymization_key) { … }
void PreconnectManager::StartPreconnectUrl(
const GURL& url,
bool allow_credentials,
net::NetworkAnonymizationKey network_anonymization_key) { … }
void PreconnectManager::Stop(const GURL& url) { … }
void PreconnectManager::PreconnectUrl(
const GURL& url,
int num_sockets,
bool allow_credentials,
const net::NetworkAnonymizationKey& network_anonymization_key) const { … }
std::unique_ptr<ResolveHostClientImpl> PreconnectManager::PreresolveUrl(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key,
ResolveHostCallback callback) const { … }
std::unique_ptr<ProxyLookupClientImpl> PreconnectManager::LookupProxyForUrl(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key,
ProxyLookupCallback callback) const { … }
void PreconnectManager::TryToLaunchPreresolveJobs() { … }
void PreconnectManager::OnPreresolveFinished(PreresolveJobId job_id,
bool success) { … }
void PreconnectManager::OnProxyLookupFinished(PreresolveJobId job_id,
bool success) { … }
void PreconnectManager::FinishPreresolveJob(PreresolveJobId job_id,
bool success) { … }
void PreconnectManager::AllPreresolvesForUrlFinished(PreresolveInfo* info) { … }
network::mojom::NetworkContext* PreconnectManager::GetNetworkContext() const { … }
}