Rename set_up_quic_server_info_factory to is_main_cache in HttpCache constructor
so that future settings could be bundled with the same boolean. BUG=686632 Review-Url: https://codereview.chromium.org/2681953002 Cr-Commit-Position: refs/heads/master@{#448859}
This commit is contained in:
chrome/browser/profiles
content/shell/browser
net
@@ -1304,7 +1304,7 @@ std::unique_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory(
|
|||||||
return base::MakeUnique<net::HttpCache>(
|
return base::MakeUnique<net::HttpCache>(
|
||||||
base::WrapUnique(new DevToolsNetworkTransactionFactory(
|
base::WrapUnique(new DevToolsNetworkTransactionFactory(
|
||||||
network_controller_handle_.GetController(), session)),
|
network_controller_handle_.GetController(), session)),
|
||||||
std::move(main_backend), true /* set_up_quic_server_info */);
|
std::move(main_backend), true /* is_main_cache */);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory(
|
std::unique_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory(
|
||||||
@@ -1315,7 +1315,7 @@ std::unique_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory(
|
|||||||
return base::MakeUnique<net::HttpCache>(
|
return base::MakeUnique<net::HttpCache>(
|
||||||
base::WrapUnique(new DevToolsNetworkTransactionFactory(
|
base::WrapUnique(new DevToolsNetworkTransactionFactory(
|
||||||
network_controller_handle_.GetController(), shared_session)),
|
network_controller_handle_.GetController(), shared_session)),
|
||||||
std::move(backend), false /* set_up_quic_server_info */);
|
std::move(backend), false /* is_main_cache */);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileIOData::SetCookieSettingsForTesting(
|
void ProfileIOData::SetCookieSettingsForTesting(
|
||||||
|
@@ -219,7 +219,7 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() {
|
|||||||
base::MakeUnique<net::HttpNetworkSession>(network_session_params));
|
base::MakeUnique<net::HttpNetworkSession>(network_session_params));
|
||||||
storage_->set_http_transaction_factory(base::MakeUnique<net::HttpCache>(
|
storage_->set_http_transaction_factory(base::MakeUnique<net::HttpCache>(
|
||||||
storage_->http_network_session(), std::move(main_backend),
|
storage_->http_network_session(), std::move(main_backend),
|
||||||
true /* set_up_quic_server_info */));
|
true /* is_main_cache */));
|
||||||
|
|
||||||
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory(
|
||||||
new net::URLRequestJobFactoryImpl());
|
new net::URLRequestJobFactoryImpl());
|
||||||
|
@@ -69,7 +69,7 @@ class RequestContext : public URLRequestContext {
|
|||||||
base::MakeUnique<HttpNetworkSession>(params));
|
base::MakeUnique<HttpNetworkSession>(params));
|
||||||
storage_.set_http_transaction_factory(base::MakeUnique<HttpCache>(
|
storage_.set_http_transaction_factory(base::MakeUnique<HttpCache>(
|
||||||
storage_.http_network_session(), HttpCache::DefaultBackend::InMemory(0),
|
storage_.http_network_session(), HttpCache::DefaultBackend::InMemory(0),
|
||||||
false /* set_up_quic_server_info */));
|
false /* is_main_cache */));
|
||||||
storage_.set_job_factory(base::MakeUnique<URLRequestJobFactoryImpl>());
|
storage_.set_job_factory(base::MakeUnique<URLRequestJobFactoryImpl>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -295,14 +295,14 @@ class HttpCache::QuicServerInfoFactoryAdaptor : public QuicServerInfoFactory {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
HttpCache::HttpCache(HttpNetworkSession* session,
|
HttpCache::HttpCache(HttpNetworkSession* session,
|
||||||
std::unique_ptr<BackendFactory> backend_factory,
|
std::unique_ptr<BackendFactory> backend_factory,
|
||||||
bool set_up_quic_server_info)
|
bool is_main_cache)
|
||||||
: HttpCache(base::MakeUnique<HttpNetworkLayer>(session),
|
: HttpCache(base::MakeUnique<HttpNetworkLayer>(session),
|
||||||
std::move(backend_factory),
|
std::move(backend_factory),
|
||||||
set_up_quic_server_info) {}
|
is_main_cache) {}
|
||||||
|
|
||||||
HttpCache::HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer,
|
HttpCache::HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer,
|
||||||
std::unique_ptr<BackendFactory> backend_factory,
|
std::unique_ptr<BackendFactory> backend_factory,
|
||||||
bool set_up_quic_server_info)
|
bool is_main_cache)
|
||||||
: net_log_(nullptr),
|
: net_log_(nullptr),
|
||||||
backend_factory_(std::move(backend_factory)),
|
backend_factory_(std::move(backend_factory)),
|
||||||
building_backend_(false),
|
building_backend_(false),
|
||||||
@@ -318,7 +318,7 @@ HttpCache::HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer,
|
|||||||
// rather than having logic only used in unit tests here.
|
// rather than having logic only used in unit tests here.
|
||||||
if (session) {
|
if (session) {
|
||||||
net_log_ = session->net_log();
|
net_log_ = session->net_log();
|
||||||
if (set_up_quic_server_info &&
|
if (is_main_cache &&
|
||||||
!session->quic_stream_factory()->has_quic_server_info_factory()) {
|
!session->quic_stream_factory()->has_quic_server_info_factory()) {
|
||||||
// QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor.
|
// QuicStreamFactory takes ownership of QuicServerInfoFactoryAdaptor.
|
||||||
session->quic_stream_factory()->set_quic_server_info_factory(
|
session->quic_stream_factory()->set_quic_server_info_factory(
|
||||||
|
@@ -123,17 +123,18 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
|
|||||||
//
|
//
|
||||||
// The HttpCache must be destroyed before the HttpNetworkSession.
|
// The HttpCache must be destroyed before the HttpNetworkSession.
|
||||||
//
|
//
|
||||||
// If |set_up_quic_server_info| is true, configures the cache to track
|
// If |is_main_cache| is true, configures the cache to track
|
||||||
// information about servers supporting QUIC.
|
// information about servers supporting QUIC.
|
||||||
|
// TODO(zhongyi): remove |is_main_cache| when we get rid of cache split.
|
||||||
HttpCache(HttpNetworkSession* session,
|
HttpCache(HttpNetworkSession* session,
|
||||||
std::unique_ptr<BackendFactory> backend_factory,
|
std::unique_ptr<BackendFactory> backend_factory,
|
||||||
bool set_up_quic_server_info);
|
bool is_main_cache);
|
||||||
|
|
||||||
// Initialize the cache from its component parts. |network_layer| and
|
// Initialize the cache from its component parts. |network_layer| and
|
||||||
// |backend_factory| will be destroyed when the HttpCache is.
|
// |backend_factory| will be destroyed when the HttpCache is.
|
||||||
HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer,
|
HttpCache(std::unique_ptr<HttpTransactionFactory> network_layer,
|
||||||
std::unique_ptr<BackendFactory> backend_factory,
|
std::unique_ptr<BackendFactory> backend_factory,
|
||||||
bool set_up_quic_server_info);
|
bool is_main_cache);
|
||||||
|
|
||||||
~HttpCache() override;
|
~HttpCache() override;
|
||||||
|
|
||||||
|
@@ -546,16 +546,15 @@ MockHttpCache::MockHttpCache(
|
|||||||
std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory)
|
std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory)
|
||||||
: MockHttpCache(std::move(disk_cache_factory), false) {}
|
: MockHttpCache(std::move(disk_cache_factory), false) {}
|
||||||
|
|
||||||
MockHttpCache::MockHttpCache(bool set_up_quic_server_info)
|
MockHttpCache::MockHttpCache(bool is_main_cache)
|
||||||
: MockHttpCache(base::MakeUnique<MockBackendFactory>(),
|
: MockHttpCache(base::MakeUnique<MockBackendFactory>(), is_main_cache) {}
|
||||||
set_up_quic_server_info) {}
|
|
||||||
|
|
||||||
MockHttpCache::MockHttpCache(
|
MockHttpCache::MockHttpCache(
|
||||||
std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory,
|
std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory,
|
||||||
bool set_up_quic_server_info)
|
bool is_main_cache)
|
||||||
: http_cache_(base::MakeUnique<MockNetworkLayer>(),
|
: http_cache_(base::MakeUnique<MockNetworkLayer>(),
|
||||||
std::move(disk_cache_factory),
|
std::move(disk_cache_factory),
|
||||||
set_up_quic_server_info) {}
|
is_main_cache) {}
|
||||||
|
|
||||||
disk_cache::Backend* MockHttpCache::backend() {
|
disk_cache::Backend* MockHttpCache::backend() {
|
||||||
TestCompletionCallback cb;
|
TestCompletionCallback cb;
|
||||||
|
@@ -182,11 +182,11 @@ class MockHttpCache {
|
|||||||
MockHttpCache();
|
MockHttpCache();
|
||||||
explicit MockHttpCache(
|
explicit MockHttpCache(
|
||||||
std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory);
|
std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory);
|
||||||
// |set_up_quic_server_info| if set, will set a quic server info factory.
|
// |is_main_cache| if set, will set a quic server info factory.
|
||||||
explicit MockHttpCache(bool set_up_quic_server_info);
|
explicit MockHttpCache(bool is_main_cache);
|
||||||
|
|
||||||
MockHttpCache(std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory,
|
MockHttpCache(std::unique_ptr<HttpCache::BackendFactory> disk_cache_factory,
|
||||||
bool set_up_quic_server_info);
|
bool is_main_cache);
|
||||||
|
|
||||||
HttpCache* http_cache() { return &http_cache_; }
|
HttpCache* http_cache() { return &http_cache_; }
|
||||||
|
|
||||||
|
@@ -7769,7 +7769,8 @@ TEST_F(URLRequestTest, QuicServerInfoFactoryTest) {
|
|||||||
new HttpNetworkLayer(&session));
|
new HttpNetworkLayer(&session));
|
||||||
|
|
||||||
HttpCache main_cache(std::move(network_layer1),
|
HttpCache main_cache(std::move(network_layer1),
|
||||||
HttpCache::DefaultBackend::InMemory(0), true);
|
HttpCache::DefaultBackend::InMemory(0),
|
||||||
|
true /* is_main_cache */);
|
||||||
|
|
||||||
EXPECT_TRUE(session.quic_stream_factory()->has_quic_server_info_factory());
|
EXPECT_TRUE(session.quic_stream_factory()->has_quic_server_info_factory());
|
||||||
|
|
||||||
@@ -7864,7 +7865,7 @@ TEST_F(URLRequestTestHTTP, NetworkSuspendTest) {
|
|||||||
|
|
||||||
HttpCache http_cache(std::move(network_layer),
|
HttpCache http_cache(std::move(network_layer),
|
||||||
HttpCache::DefaultBackend::InMemory(0),
|
HttpCache::DefaultBackend::InMemory(0),
|
||||||
false /* set_up_quic_server_info_factory */);
|
false /* is_main_cache */);
|
||||||
|
|
||||||
TestURLRequestContext context(true);
|
TestURLRequestContext context(true);
|
||||||
context.set_http_transaction_factory(&http_cache);
|
context.set_http_transaction_factory(&http_cache);
|
||||||
@@ -9205,8 +9206,9 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) {
|
|||||||
params.http_server_properties = default_context_.http_server_properties();
|
params.http_server_properties = default_context_.http_server_properties();
|
||||||
|
|
||||||
HttpNetworkSession network_session(params);
|
HttpNetworkSession network_session(params);
|
||||||
std::unique_ptr<HttpCache> cache(new HttpCache(
|
std::unique_ptr<HttpCache> cache(
|
||||||
&network_session, HttpCache::DefaultBackend::InMemory(0), false));
|
new HttpCache(&network_session, HttpCache::DefaultBackend::InMemory(0),
|
||||||
|
false /* is_main_cache */));
|
||||||
|
|
||||||
default_context_.set_http_transaction_factory(cache.get());
|
default_context_.set_http_transaction_factory(cache.get());
|
||||||
|
|
||||||
|
@@ -38,7 +38,7 @@ class TestURLRequestContext : public URLRequestContext {
|
|||||||
TestURLRequestContext::TestURLRequestContext()
|
TestURLRequestContext::TestURLRequestContext()
|
||||||
: cache_(base::MakeUnique<MockNetworkLayer>(),
|
: cache_(base::MakeUnique<MockNetworkLayer>(),
|
||||||
HttpCache::DefaultBackend::InMemory(0),
|
HttpCache::DefaultBackend::InMemory(0),
|
||||||
false /* set_up_quic_server_info */) {
|
false /* is_main_cache */) {
|
||||||
set_http_transaction_factory(&cache_);
|
set_http_transaction_factory(&cache_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user