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

Unified Diff: chrome/browser/net/predictor.h

Issue 2084093002: Use lossy prefs in the net predictor, and update them more frequently (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@predictor_lru
Patch Set: kill waitable event references Created 4 years, 5 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/net/predictor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/predictor.h
diff --git a/chrome/browser/net/predictor.h b/chrome/browser/net/predictor.h
index 527a366eba090f0a43ab5d8c8d5f701205389f08..572f19c8b2fda28e18ecf7301d4804ece27d4a9e 100644
--- a/chrome/browser/net/predictor.h
+++ b/chrome/browser/net/predictor.h
@@ -47,7 +47,6 @@ class ProfileIOData;
namespace base {
class ListValue;
-class WaitableEvent;
}
namespace net {
@@ -172,10 +171,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 +243,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 +540,17 @@ 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
+ // thread.
+ std::unique_ptr<base::WeakPtrFactory<Predictor>> ui_weak_factory_;
// Protects |preconnect_enabled_|.
mutable base::Lock preconnect_enabled_lock_;
« no previous file with comments | « no previous file | chrome/browser/net/predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698