Index: chrome/browser/profiles/profile_impl.cc |
=================================================================== |
--- chrome/browser/profiles/profile_impl.cc (revision 96009) |
+++ chrome/browser/profiles/profile_impl.cc (working copy) |
@@ -48,6 +48,7 @@ |
#include "chrome/browser/net/chrome_url_request_context.h" |
#include "chrome/browser/net/gaia/token_service.h" |
#include "chrome/browser/net/net_pref_observer.h" |
+#include "chrome/browser/net/predictor.h" |
#include "chrome/browser/net/pref_proxy_config_service.h" |
#include "chrome/browser/net/ssl_config_service_manager.h" |
#include "chrome/browser/password_manager/password_store_default.h" |
@@ -309,7 +310,8 @@ |
#if defined(OS_WIN) |
checked_instant_promo_(false), |
#endif |
- delegate_(delegate) { |
+ delegate_(delegate), |
+ predictor_(NULL) { |
DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
"profile files to the root directory!"; |
@@ -317,6 +319,9 @@ |
TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
&ProfileImpl::EnsureSessionServiceCreated); |
+ predictor_ = new chrome_browser_net::Predictor(); |
+ predictor_->AddRef(); |
willchan no longer on Chromium
2011/08/10 07:04:08
I don't think the AddRef() is needed since I advis
rpetterson
2011/08/12 03:12:36
Done.
|
+ |
if (delegate_) { |
prefs_.reset(PrefService::CreatePrefService( |
GetPrefFilePath(), |
@@ -438,7 +443,7 @@ |
// initialized that we might be reading from the IO thread. |
io_data_.Init(cookie_path, cache_path, cache_max_size, |
media_cache_path, media_cache_max_size, extensions_cookie_path, |
- app_path); |
+ app_path, predictor_); |
// Creation has been finished. |
if (delegate_) |
@@ -650,6 +655,10 @@ |
} |
ProfileImpl::~ProfileImpl() { |
+ DCHECK(predictor_); |
+ predictor_->SaveStateForNextStartupAndTrim(GetPrefs()); |
+ predictor_->Shutdown(); |
willchan no longer on Chromium
2011/08/10 07:04:08
According to the comments in predictor.h, this is
rpetterson
2011/08/12 03:12:36
Thanks for catching this. Since the profile doesn'
|
+ |
NotificationService::current()->Notify( |
chrome::NOTIFICATION_PROFILE_DESTROYED, |
Source<Profile>(this), |
@@ -896,7 +905,7 @@ |
DCHECK(!net_pref_observer_.get()); |
net_pref_observer_.reset( |
- new NetPrefObserver(prefs_.get(), GetPrerenderManager())); |
+ new NetPrefObserver(prefs_.get(), GetPrerenderManager(), predictor_)); |
DoFinalInit(); |
} |
@@ -1746,3 +1755,7 @@ |
} |
return prerender_manager_.get(); |
} |
+ |
+chrome_browser_net::Predictor* ProfileImpl::GetNetworkPredictor() { |
+ return predictor_; |
+} |