Chromium Code Reviews| Index: chrome/browser/net/predictor.h |
| diff --git a/chrome/browser/net/predictor.h b/chrome/browser/net/predictor.h |
| index 527a366eba090f0a43ab5d8c8d5f701205389f08..df3a69ea5b381dd5515b8c22416cb80ca3b84e35 100644 |
| --- a/chrome/browser/net/predictor.h |
| +++ b/chrome/browser/net/predictor.h |
| @@ -172,10 +172,16 @@ class Predictor { |
| virtual void ShutdownOnUIThread(); |
| + void UpdatePrefsOnUIThread(std::unique_ptr<base::ListValue> startup_list, |
| + std::unique_ptr<base::ListValue> referral_list); |
| + |
| // ------------- End UI thread methods. |
| // ------------- Start IO thread methods. |
| + void WriteDnsPrefetchState(base::ListValue* startup_list, |
| + base::ListValue* referral_list); |
| + |
| // Cancel pending requests and prevent new ones from being made. |
| void Shutdown(); |
| @@ -238,14 +244,9 @@ class Predictor { |
| void DnsPrefetchMotivatedList(const std::vector<GURL>& urls, |
| UrlInfo::ResolutionMotivation motivation); |
| - // May be called from either the IO or UI thread and will PostTask |
| - // to the IO thread if necessary. |
| + // Called from the UI thread in response to the load event. |
| void SaveStateForNextStartup(); |
| - void SaveDnsPrefetchStateForNextStartup(base::ListValue* startup_list, |
| - base::ListValue* referral_list, |
| - base::WaitableEvent* completion); |
| - |
| // May be called from either the IO or UI thread and will PostTask |
| // to the IO thread if necessary. |
| void PreconnectUrl(const GURL& url, |
| @@ -540,7 +541,16 @@ class Predictor { |
| std::unique_ptr<TimedCache> timed_cache_; |
| - std::unique_ptr<base::WeakPtrFactory<Predictor>> weak_factory_; |
| + // TODO(csharrison): It is not great that two weak pointer factories are |
| + // needed in this class. Let's split it into two classes that live on each |
| + // thread. |
| + // |
| + // Weak factory for weak pointers that should be dereferenced on the IO |
| + // thread. |
| + std::unique_ptr<base::WeakPtrFactory<Predictor>> io_weak_factory_; |
| + // Weak factory for weak pointers that should be dereferenced on the UI |
|
Bernhard Bauer
2016/08/01 09:06:24
Nit: Empty line before the comment?
Charlie Harrison
2016/08/01 12:38:24
Done.
|
| + // thread. |
| + std::unique_ptr<base::WeakPtrFactory<Predictor>> ui_weak_factory_; |
| // Protects |preconnect_enabled_|. |
| mutable base::Lock preconnect_enabled_lock_; |