Commit 0066d1cf authored by Clark DuVall's avatar Clark DuVall Committed by Commit Bot

Remove unused fields from DataReductionProxyDelegate

Looks like the timing info is no longer being used.

Bug: 721403
Change-Id: Id99af7695e93026211b97567296daccfd84ed176
Reviewed-on: https://chromium-review.googlesource.com/1238620Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593310}
parent d38e9e8c
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
...@@ -40,16 +38,13 @@ DataReductionProxyDelegate::DataReductionProxyDelegate( ...@@ -40,16 +38,13 @@ DataReductionProxyDelegate::DataReductionProxyDelegate(
const DataReductionProxyConfigurator* configurator, const DataReductionProxyConfigurator* configurator,
DataReductionProxyEventCreator* event_creator, DataReductionProxyEventCreator* event_creator,
DataReductionProxyBypassStats* bypass_stats, DataReductionProxyBypassStats* bypass_stats,
net::NetLog* net_log, net::NetLog* net_log)
network::NetworkConnectionTracker* network_connection_tracker)
: config_(config), : config_(config),
configurator_(configurator), configurator_(configurator),
event_creator_(event_creator), event_creator_(event_creator),
bypass_stats_(bypass_stats), bypass_stats_(bypass_stats),
tick_clock_(base::DefaultTickClock::GetInstance()),
io_data_(nullptr), io_data_(nullptr),
net_log_(net_log), net_log_(net_log) {
network_connection_tracker_(network_connection_tracker) {
DCHECK(config_); DCHECK(config_);
DCHECK(configurator_); DCHECK(configurator_);
DCHECK(event_creator_); DCHECK(event_creator_);
...@@ -61,14 +56,12 @@ DataReductionProxyDelegate::DataReductionProxyDelegate( ...@@ -61,14 +56,12 @@ DataReductionProxyDelegate::DataReductionProxyDelegate(
DataReductionProxyDelegate::~DataReductionProxyDelegate() { DataReductionProxyDelegate::~DataReductionProxyDelegate() {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
network_connection_tracker_->RemoveNetworkConnectionObserver(this);
} }
void DataReductionProxyDelegate::InitializeOnIOThread( void DataReductionProxyDelegate::InitializeOnIOThread(
DataReductionProxyIOData* io_data) { DataReductionProxyIOData* io_data) {
DCHECK(io_data); DCHECK(io_data);
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
network_connection_tracker_->AddNetworkConnectionObserver(this);
io_data_ = io_data; io_data_ = io_data;
} }
...@@ -169,14 +162,6 @@ void DataReductionProxyDelegate::OnFallback(const net::ProxyServer& bad_proxy, ...@@ -169,14 +162,6 @@ void DataReductionProxyDelegate::OnFallback(const net::ProxyServer& bad_proxy,
bypass_stats_->OnProxyFallback(bad_proxy, net_error); bypass_stats_->OnProxyFallback(bad_proxy, net_error);
} }
void DataReductionProxyDelegate::SetTickClockForTesting(
const base::TickClock* tick_clock) {
tick_clock_ = tick_clock;
// Update |last_network_change_time_| to the provided tick clock's current
// time for testing.
last_network_change_time_ = tick_clock_->NowTicks();
}
void DataReductionProxyDelegate::GetAlternativeProxy( void DataReductionProxyDelegate::GetAlternativeProxy(
const GURL& url, const GURL& url,
const net::ProxyRetryInfoMap& proxy_retry_info, const net::ProxyRetryInfoMap& proxy_retry_info,
...@@ -236,14 +221,4 @@ void DataReductionProxyDelegate::RecordQuicProxyStatus( ...@@ -236,14 +221,4 @@ void DataReductionProxyDelegate::RecordQuicProxyStatus(
QUIC_PROXY_STATUS_BOUNDARY); QUIC_PROXY_STATUS_BOUNDARY);
} }
void DataReductionProxyDelegate::OnConnectionChanged(
network::mojom::ConnectionType type) {
DCHECK(thread_checker_.CalledOnValidThread());
if (type == network::mojom::ConnectionType::CONNECTION_NONE)
return;
last_network_change_time_ = tick_clock_->NowTicks();
}
} // namespace data_reduction_proxy } // namespace data_reduction_proxy
...@@ -11,13 +11,8 @@ ...@@ -11,13 +11,8 @@
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "net/base/proxy_delegate.h" #include "net/base/proxy_delegate.h"
#include "net/proxy_resolution/proxy_retry_info.h" #include "net/proxy_resolution/proxy_retry_info.h"
#include "services/network/public/cpp/network_connection_tracker.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace base {
class TickClock;
}
namespace net { namespace net {
class NetLog; class NetLog;
class ProxyInfo; class ProxyInfo;
...@@ -32,19 +27,15 @@ class DataReductionProxyConfigurator; ...@@ -32,19 +27,15 @@ class DataReductionProxyConfigurator;
class DataReductionProxyEventCreator; class DataReductionProxyEventCreator;
class DataReductionProxyIOData; class DataReductionProxyIOData;
class DataReductionProxyDelegate class DataReductionProxyDelegate : public net::ProxyDelegate {
: public net::ProxyDelegate,
public network::NetworkConnectionTracker::NetworkConnectionObserver {
public: public:
// ProxyDelegate instance is owned by io_thread. |auth_handler| and |config| // ProxyDelegate instance is owned by io_thread. |auth_handler| and |config|
// outlives this class instance. // outlives this class instance.
DataReductionProxyDelegate( DataReductionProxyDelegate(DataReductionProxyConfig* config,
DataReductionProxyConfig* config, const DataReductionProxyConfigurator* configurator,
const DataReductionProxyConfigurator* configurator, DataReductionProxyEventCreator* event_creator,
DataReductionProxyEventCreator* event_creator, DataReductionProxyBypassStats* bypass_stats,
DataReductionProxyBypassStats* bypass_stats, net::NetLog* net_log);
net::NetLog* net_log,
network::NetworkConnectionTracker* network_connection_tracker);
~DataReductionProxyDelegate() override; ~DataReductionProxyDelegate() override;
...@@ -58,8 +49,6 @@ class DataReductionProxyDelegate ...@@ -58,8 +49,6 @@ class DataReductionProxyDelegate
net::ProxyInfo* result) override; net::ProxyInfo* result) override;
void OnFallback(const net::ProxyServer& bad_proxy, int net_error) override; void OnFallback(const net::ProxyServer& bad_proxy, int net_error) override;
void SetTickClockForTesting(const base::TickClock* tick_clock);
protected: protected:
// Protected so that it can be overridden during testing. // Protected so that it can be overridden during testing.
// Returns true if |proxy_server| supports QUIC. // Returns true if |proxy_server| supports QUIC.
...@@ -79,9 +68,6 @@ class DataReductionProxyDelegate ...@@ -79,9 +68,6 @@ class DataReductionProxyDelegate
// Records the availability status of data reduction proxy. // Records the availability status of data reduction proxy.
void RecordQuicProxyStatus(QuicProxyStatus status) const; void RecordQuicProxyStatus(QuicProxyStatus status) const;
// network::NetworkConnectionTracker::NetworkConnectionObserver:
void OnConnectionChanged(network::mojom::ConnectionType type) override;
// Checks if the first proxy server in |result| supports QUIC and if so // Checks if the first proxy server in |result| supports QUIC and if so
// adds an alternative proxy configuration to |result|. // adds an alternative proxy configuration to |result|.
void GetAlternativeProxy(const GURL& url, void GetAlternativeProxy(const GURL& url,
...@@ -93,19 +79,10 @@ class DataReductionProxyDelegate ...@@ -93,19 +79,10 @@ class DataReductionProxyDelegate
DataReductionProxyEventCreator* event_creator_; DataReductionProxyEventCreator* event_creator_;
DataReductionProxyBypassStats* bypass_stats_; DataReductionProxyBypassStats* bypass_stats_;
// Tick clock used for obtaining the current time.
const base::TickClock* tick_clock_;
// Set to the time when last IP address change event was received, or the time
// of initialization of |this|, whichever is later.
base::TimeTicks last_network_change_time_;
DataReductionProxyIOData* io_data_; DataReductionProxyIOData* io_data_;
net::NetLog* net_log_; net::NetLog* net_log_;
network::NetworkConnectionTracker* network_connection_tracker_;
base::ThreadChecker thread_checker_; base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(DataReductionProxyDelegate); DISALLOW_COPY_AND_ASSIGN(DataReductionProxyDelegate);
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h" #include "net/url_request/url_request_test_util.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using testing::_; using testing::_;
...@@ -89,13 +88,11 @@ class TestDataReductionProxyDelegate : public DataReductionProxyDelegate { ...@@ -89,13 +88,11 @@ class TestDataReductionProxyDelegate : public DataReductionProxyDelegate {
DataReductionProxyBypassStats* bypass_stats, DataReductionProxyBypassStats* bypass_stats,
bool proxy_supports_quic, bool proxy_supports_quic,
net::NetLog* net_log) net::NetLog* net_log)
: DataReductionProxyDelegate( : DataReductionProxyDelegate(config,
config, configurator,
configurator, event_creator,
event_creator, bypass_stats,
bypass_stats, net_log),
net_log,
network::TestNetworkConnectionTracker::GetInstance()),
proxy_supports_quic_(proxy_supports_quic) {} proxy_supports_quic_(proxy_supports_quic) {}
~TestDataReductionProxyDelegate() override {} ~TestDataReductionProxyDelegate() override {}
......
...@@ -173,7 +173,7 @@ DataReductionProxyIOData::DataReductionProxyIOData( ...@@ -173,7 +173,7 @@ DataReductionProxyIOData::DataReductionProxyIOData(
proxy_delegate_.reset(new DataReductionProxyDelegate( proxy_delegate_.reset(new DataReductionProxyDelegate(
config_.get(), configurator_.get(), event_creator_.get(), config_.get(), configurator_.get(), event_creator_.get(),
bypass_stats_.get(), net_log_, network_connection_tracker_)); bypass_stats_.get(), net_log_));
network_properties_manager_.reset(new NetworkPropertiesManager( network_properties_manager_.reset(new NetworkPropertiesManager(
base::DefaultClock::GetInstance(), prefs, ui_task_runner_)); base::DefaultClock::GetInstance(), prefs, ui_task_runner_));
} }
...@@ -297,7 +297,7 @@ DataReductionProxyIOData::CreateProxyDelegate() const { ...@@ -297,7 +297,7 @@ DataReductionProxyIOData::CreateProxyDelegate() const {
DCHECK(io_task_runner_->BelongsToCurrentThread()); DCHECK(io_task_runner_->BelongsToCurrentThread());
return std::make_unique<DataReductionProxyDelegate>( return std::make_unique<DataReductionProxyDelegate>(
config_.get(), configurator_.get(), event_creator_.get(), config_.get(), configurator_.get(), event_creator_.get(),
bypass_stats_.get(), net_log_, network_connection_tracker_); bypass_stats_.get(), net_log_);
} }
// TODO(kundaji): Rename this method to something more descriptive. // TODO(kundaji): Rename this method to something more descriptive.
......
...@@ -539,8 +539,7 @@ DataReductionProxyTestContext::Builder::Build() { ...@@ -539,8 +539,7 @@ DataReductionProxyTestContext::Builder::Build() {
io_data->set_proxy_delegate(base::WrapUnique(new DataReductionProxyDelegate( io_data->set_proxy_delegate(base::WrapUnique(new DataReductionProxyDelegate(
io_data->config(), io_data->configurator(), io_data->event_creator(), io_data->config(), io_data->configurator(), io_data->event_creator(),
io_data->bypass_stats(), net_log.get(), io_data->bypass_stats(), net_log.get())));
test_network_connection_tracker)));
std::unique_ptr<DataReductionProxyTestContext> test_context( std::unique_ptr<DataReductionProxyTestContext> test_context(
new DataReductionProxyTestContext( new DataReductionProxyTestContext(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment