Index: chrome/browser/profiles/profile_impl_io_data.cc |
=================================================================== |
--- chrome/browser/profiles/profile_impl_io_data.cc (revision 96009) |
+++ chrome/browser/profiles/profile_impl_io_data.cc (working copy) |
@@ -12,6 +12,8 @@ |
#include "chrome/browser/io_thread.h" |
#include "chrome/browser/net/chrome_net_log.h" |
#include "chrome/browser/net/chrome_network_delegate.h" |
+#include "chrome/browser/net/connect_interceptor.h" |
+#include "chrome/browser/net/predictor.h" |
#include "chrome/browser/net/sqlite_persistent_cookie_store.h" |
#include "chrome/browser/prefs/pref_member.h" |
#include "chrome/browser/profiles/profile.h" |
@@ -23,6 +25,7 @@ |
#include "content/browser/resource_context.h" |
#include "net/ftp/ftp_network_layer.h" |
#include "net/http/http_cache.h" |
+#include "net/url_request/url_request_job_factory.h" |
ProfileImplIOData::Handle::Handle(Profile* profile) |
: io_data_(new ProfileImplIOData), |
@@ -52,13 +55,15 @@ |
io_data_->ShutdownOnUIThread(); |
} |
-void ProfileImplIOData::Handle::Init(const FilePath& cookie_path, |
- const FilePath& cache_path, |
- int cache_max_size, |
- const FilePath& media_cache_path, |
- int media_cache_max_size, |
- const FilePath& extensions_cookie_path, |
- const FilePath& app_path) { |
+void ProfileImplIOData::Handle::Init( |
+ const FilePath& cookie_path, |
+ const FilePath& cache_path, |
+ int cache_max_size, |
+ const FilePath& media_cache_path, |
+ int media_cache_max_size, |
+ const FilePath& extensions_cookie_path, |
+ const FilePath& app_path, |
+ chrome_browser_net::Predictor* predictor) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!io_data_->lazy_params_.get()); |
LazyParams* lazy_params = new LazyParams; |
@@ -74,6 +79,9 @@ |
// Keep track of isolated app path separately so we can use it on demand. |
io_data_->app_path_ = app_path; |
+ |
+ io_data_->predictor_.reset(predictor); |
+ io_data_->predictor_->InitNetworkPredictor(profile_->GetPrefs()); |
} |
base::Callback<ChromeURLDataManagerBackend*(void)> |
@@ -151,6 +159,11 @@ |
return context; |
} |
+chrome_browser_net::Predictor* |
+ProfileImplIOData::Handle::GetNetworkPredictor() { |
+ return io_data_->GetNetworkPredictor(); |
+} |
+ |
void ProfileImplIOData::Handle::LazyInitialize() const { |
if (!initialized_) { |
io_data_->InitializeProfileParams(profile_); |
@@ -307,6 +320,9 @@ |
media_request_context_->set_job_factory(job_factory()); |
extensions_context->set_job_factory(job_factory()); |
+ job_factory()->AddInterceptor( |
+ new chrome_browser_net::ConnectInterceptor(predictor_.get())); |
+ |
lazy_params_.reset(); |
} |
@@ -388,3 +404,7 @@ |
DCHECK(app_request_context); |
return app_request_context; |
} |
+ |
+chrome_browser_net::Predictor* ProfileImplIOData::GetNetworkPredictor() { |
+ return predictor_.get(); |
+} |