chromium/components/cronet/cronet_context.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/cronet/cronet_context.h"

#include <limits.h>
#include <stddef.h>
#include <stdint.h>

#include <limits>
#include <map>
#include <memory>
#include <set>
#include <utility>

#include "base/base64.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/metrics/statistics_recorder.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "components/cronet/cronet_global_state.h"
#include "components/cronet/cronet_prefs_manager.h"
#include "components/cronet/host_cache_persistence_manager.h"
#include "components/cronet/url_request_context_config.h"
#include "net/base/ip_address.h"
#include "net/base/load_flags.h"
#include "net/base/logging_network_change_observer.h"
#include "net/base/net_errors.h"
#include "net/base/network_delegate_impl.h"
#include "net/base/network_isolation_key.h"
#include "net/base/url_util.h"
#include "net/cert/caching_cert_verifier.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/x509_certificate.h"
#include "net/cookies/cookie_inclusion_status.h"
#include "net/cookies/cookie_monster.h"
#include "net/cookies/cookie_setting_override.h"
#include "net/first_party_sets/first_party_set_metadata.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/transport_security_state.h"
#include "net/log/file_net_log_observer.h"
#include "net/log/net_log_util.h"
#include "net/net_buildflags.h"
#include "net/nqe/network_quality_estimator_params.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/third_party/quiche/src/quiche/quic/core/quic_versions.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_interceptor.h"

#if BUILDFLAG(ENABLE_REPORTING)
#include "net/network_error_logging/network_error_logging_service.h"
#include "net/reporting/reporting_service.h"
#endif  // BUILDFLAG(ENABLE_REPORTING)

namespace {

// This class wraps a NetLog that also contains network change events.
class NetLogWithNetworkChangeEvents {};

// Use a global NetLog instance. See crbug.com/486120.
static base::LazyInstance<NetLogWithNetworkChangeEvents>::Leaky g_net_log =;

class BasicNetworkDelegate : public net::NetworkDelegateImpl {};

// Helper function to make a net::URLRequestContext aware of a QUIC hint.
void SetQuicHint(net::URLRequestContext* context,
                 const cronet::URLRequestContextConfig::QuicHint* quic_hint) {}

// net::NetworkChangeNotifier doesn't provide an API to query if a specific
// network has become disconnected. For these network though, it will return
// CONNECTION_UNKNOWN as their connection type. This should be a good enough
// approximation for the time being.
bool IsNetworkNoLongerConnected(net::handles::NetworkHandle network) {}

}  // namespace

namespace cronet {

CronetContext::CronetContext(
    std::unique_ptr<URLRequestContextConfig> context_config,
    std::unique_ptr<Callback> callback,
    scoped_refptr<base::SingleThreadTaskRunner> network_task_runner)
    :{}

CronetContext::~CronetContext() {}

CronetContext::NetworkTasks::NetworkTasks(
    std::unique_ptr<URLRequestContextConfig> context_config,
    std::unique_ptr<CronetContext::Callback> callback)
    :{}

CronetContext::NetworkTasks::~NetworkTasks() {}

void CronetContext::InitRequestContextOnInitThread() {}

void CronetContext::NetworkTasks::ConfigureNetworkQualityEstimatorForTesting(
    bool use_local_host_requests,
    bool use_smaller_responses,
    bool disable_offline_check) {}

void CronetContext::ConfigureNetworkQualityEstimatorForTesting(
    bool use_local_host_requests,
    bool use_smaller_responses,
    bool disable_offline_check) {}

bool CronetContext::URLRequestContextExistsForTesting(
    net::handles::NetworkHandle network) {}

void CronetContext::NetworkTasks::ProvideRTTObservations(bool should) {}

void CronetContext::ProvideRTTObservations(bool should) {}

void CronetContext::NetworkTasks::ProvideThroughputObservations(bool should) {}

void CronetContext::ProvideThroughputObservations(bool should) {}

void CronetContext::NetworkTasks::SpawnNetworkBoundURLRequestContextForTesting(
    net::handles::NetworkHandle network) {}

bool CronetContext::NetworkTasks::URLRequestContextExistsForTesting(
    net::handles::NetworkHandle network) {}

std::unique_ptr<net::URLRequestContext>
CronetContext::NetworkTasks::BuildDefaultURLRequestContext(
    std::unique_ptr<net::ProxyConfigService> proxy_config_service) {}

std::unique_ptr<net::URLRequestContext>
CronetContext::NetworkTasks::BuildNetworkBoundURLRequestContext(
    net::handles::NetworkHandle network) {}

void CronetContext::NetworkTasks::SetSharedURLRequestContextBuilderConfig(
    net::URLRequestContextBuilder* context_builder) {}

void CronetContext::NetworkTasks::SetSharedURLRequestContextConfig(
    net::URLRequestContext* context) {}

void CronetContext::NetworkTasks::Initialize(
    scoped_refptr<base::SingleThreadTaskRunner> network_task_runner,
    scoped_refptr<base::SequencedTaskRunner> file_task_runner,
    std::unique_ptr<net::ProxyConfigService> proxy_config_service) {}

net::URLRequestContext* CronetContext::NetworkTasks::GetURLRequestContext(
    net::handles::NetworkHandle network) {}

void CronetContext::NetworkTasks::MaybeDestroyURLRequestContext(
    net::handles::NetworkHandle network) {}

// Request context getter for CronetContext.
class CronetContext::ContextGetter : public net::URLRequestContextGetter {};

net::URLRequestContextGetter* CronetContext::CreateURLRequestContextGetter() {}

net::URLRequestContext* CronetContext::GetURLRequestContext(
    net::handles::NetworkHandle network) {}

void CronetContext::PostTaskToNetworkThread(const base::Location& posted_from,
                                            base::OnceClosure callback) {}

void CronetContext::NetworkTasks::RunTaskAfterContextInit(
    base::OnceClosure task_to_run_after_context_init) {}

bool CronetContext::IsOnNetworkThread() const {}

scoped_refptr<base::SingleThreadTaskRunner>
CronetContext::GetNetworkTaskRunner() const {}

bool CronetContext::StartNetLogToFile(const std::string& file_name,
                                      bool log_all) {}

void CronetContext::StartNetLogToDisk(const std::string& dir_name,
                                      bool log_all,
                                      int max_size) {}

void CronetContext::StopNetLog() {}

void CronetContext::FlushWritePropertiesForTesting() {}

void CronetContext::MaybeDestroyURLRequestContext(
    net::handles::NetworkHandle network) {}

int CronetContext::default_load_flags() const {}

base::Thread* CronetContext::GetFileThread() {}

void CronetContext::NetworkTasks::OnEffectiveConnectionTypeChanged(
    net::EffectiveConnectionType effective_connection_type) {}

void CronetContext::NetworkTasks::OnRTTOrThroughputEstimatesComputed(
    base::TimeDelta http_rtt,
    base::TimeDelta transport_rtt,
    int32_t downstream_throughput_kbps) {}

void CronetContext::NetworkTasks::OnRTTObservation(
    int32_t rtt_ms,
    const base::TimeTicks& timestamp,
    net::NetworkQualityObservationSource source) {}

void CronetContext::NetworkTasks::OnThroughputObservation(
    int32_t throughput_kbps,
    const base::TimeTicks& timestamp,
    net::NetworkQualityObservationSource source) {}

void CronetContext::NetworkTasks::OnNetworkDisconnected(
    net::handles::NetworkHandle network) {}

void CronetContext::NetworkTasks::OnNetworkConnected(
    net::handles::NetworkHandle network) {}
void CronetContext::NetworkTasks::OnNetworkSoonToDisconnect(
    net::handles::NetworkHandle network) {}
void CronetContext::NetworkTasks::OnNetworkMadeDefault(
    net::handles::NetworkHandle network) {}

void CronetContext::NetworkTasks::StartNetLog(const base::FilePath& file_path,
                                              bool include_socket_bytes) {}

void CronetContext::NetworkTasks::StartNetLogToBoundedFile(
    const std::string& dir_path,
    bool include_socket_bytes,
    int size) {}

void CronetContext::NetworkTasks::StopNetLog() {}

void CronetContext::NetworkTasks::StopNetLogCompleted() {}

base::Value CronetContext::NetworkTasks::GetNetLogInfo() const {}

}  // namespace cronet