Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2151)

Unified Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 1217563005: Create unique HttpNetworkSession for storage partition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wired up remaining state for HttpNetworkSession. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl_io_data.cc
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index fc465a72334d80212a6694fb14bc45d768fa3e95..a4f4e2d5546749887ff7e6d5b38588d870cc44d7 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -54,11 +54,16 @@
#include "extensions/common/constants.h"
#include "net/base/cache_type.h"
#include "net/base/sdch_manager.h"
+#include "net/cert/cert_policy_enforcer.h"
+#include "net/cert/cert_verifier.h"
+#include "net/cert/multi_log_ct_verifier.h"
+#include "net/dns/host_resolver.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/http/http_cache.h"
#include "net/http/http_server_properties_manager.h"
#include "net/sdch/sdch_owner.h"
#include "net/ssl/channel_id_service.h"
+#include "net/ssl/ssl_config_service_defaults.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h"
#include "storage/browser/quota/special_storage_policy.h"
@@ -664,10 +669,42 @@ net::URLRequestContext* ProfileImplIOData::InitializeAppRequestContext(
app_cache_max_size_,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE));
}
- net::HttpNetworkSession* main_network_session =
- main_http_factory_->GetSession();
+
+ // Clone network session parameters from the main HttpNetworkSession, then
+ // create a unique HttpNetworkSession. Below we create isolated versions of
+ // the state elements necessary to get a completely isolated socket pool for
+ // the app.
+ net::HttpNetworkSession::Params params =
+ main_http_factory_->GetSession()->params();
+
+ // Create isolated HostResolver. Assume it's ok to re-use the net_log
+ // from the main_context.
+ context->SetHostResolver(
+ net::HostResolver::CreateDefaultResolver(main_context->net_log()));
+ params.host_resolver = context->host_resolver();
+ params.client_socket_factory = nullptr; // Force creation of new sockets.
+ context->SetCertVerifier(make_scoped_ptr(net::CertVerifier::CreateDefault()));
+ params.cert_verifier = context->cert_verifier();
+ context->SetChannelIDService(make_scoped_ptr(
+ new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr),
+ base::WorkerPool::GetTaskRunner(true))));
+ params.channel_id_service = context->channel_id_service();
+ context->SetTransportSecurityState(
+ make_scoped_ptr(new net::TransportSecurityState));
+ params.transport_security_state = context->transport_security_state();
+ context->SetCertTransparencyVerifier(
+ make_scoped_ptr(new net::MultiLogCTVerifier()));
+ params.cert_transparency_verifier = context->cert_transparency_verifier();
+ context->SetCertPolicyEnforcer(make_scoped_ptr(new net::CertPolicyEnforcer));
+ params.cert_policy_enforcer = context->cert_policy_enforcer();
+ context->SetSSLConfigService(new net::SSLConfigServiceDefaults);
+ params.ssl_config_service = context->ssl_config_service();
+
+ // Create new, isolated-state HttpNetworkSession.
+ net::HttpNetworkSession* new_network_session =
+ new net::HttpNetworkSession(params);
scoped_ptr<net::HttpCache> app_http_cache =
- CreateHttpFactory(main_network_session, app_backend);
+ CreateHttpFactory(new_network_session, app_backend);
scoped_refptr<net::CookieStore> cookie_store = NULL;
if (partition_descriptor.in_memory) {
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698