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

Side by Side 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: Make saving prefs a little saner and a little insaner Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/net/predictor.cc » ('j') | chrome/browser/net/predictor.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A Predictor object is instantiated once in the browser process, and manages 5 // A Predictor object is instantiated once in the browser process, and manages
6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected 6 // both preresolution of hostnames, as well as TCP/IP preconnection to expected
7 // subresources. 7 // subresources.
8 // Most hostname lists are provided by the renderer processes, and include URLs 8 // Most hostname lists are provided by the renderer processes, and include URLs
9 // that *might* be used in the near future by the browsing user. One goal of 9 // that *might* be used in the near future by the browsing user. One goal of
10 // this class is to cause the underlying DNS structure to lookup a hostname 10 // this class is to cause the underlying DNS structure to lookup a hostname
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Clears the preferences used by the predictor. Must be called on the UI 165 // Clears the preferences used by the predictor. Must be called on the UI
166 // thread. 166 // thread.
167 void ClearPrefsOnUIThread(); 167 void ClearPrefsOnUIThread();
168 168
169 static void set_max_queueing_delay(int max_queueing_delay_ms); 169 static void set_max_queueing_delay(int max_queueing_delay_ms);
170 170
171 static void set_max_parallel_resolves(size_t max_parallel_resolves); 171 static void set_max_parallel_resolves(size_t max_parallel_resolves);
172 172
173 virtual void ShutdownOnUIThread(); 173 virtual void ShutdownOnUIThread();
174 174
175 void UpdatePrefsOnUIThread(base::ListValue* startup_list,
176 base::ListValue* referral_list);
177
175 // ------------- End UI thread methods. 178 // ------------- End UI thread methods.
176 179
177 // ------------- Start IO thread methods. 180 // ------------- Start IO thread methods.
178 181
182 void WriteDnsPrefetchState(base::ListValue* startup_list,
183 base::ListValue* referral_list);
184
179 // Cancel pending requests and prevent new ones from being made. 185 // Cancel pending requests and prevent new ones from being made.
180 void Shutdown(); 186 void Shutdown();
181 187
182 // In some circumstances, for privacy reasons, all results should be 188 // In some circumstances, for privacy reasons, all results should be
183 // discarded. This method gracefully handles that activity. 189 // discarded. This method gracefully handles that activity.
184 // Destroy all our internal state, which shows what names we've looked up, and 190 // Destroy all our internal state, which shows what names we've looked up, and
185 // how long each has taken, etc. etc. We also destroy records of suggesses 191 // how long each has taken, etc. etc. We also destroy records of suggesses
186 // (cache hits etc.). 192 // (cache hits etc.).
187 void DiscardAllResults(); 193 void DiscardAllResults();
188 194
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 237
232 // Renderer bundles up list and sends to this browser API via IPC. 238 // Renderer bundles up list and sends to this browser API via IPC.
233 // TODO(csharrison): Use a GURL vector instead to include port and scheme. 239 // TODO(csharrison): Use a GURL vector instead to include port and scheme.
234 void DnsPrefetchList(const std::vector<std::string>& hostnames); 240 void DnsPrefetchList(const std::vector<std::string>& hostnames);
235 241
236 // May be called from either the IO or UI thread and will PostTask 242 // May be called from either the IO or UI thread and will PostTask
237 // to the IO thread if necessary. 243 // to the IO thread if necessary.
238 void DnsPrefetchMotivatedList(const std::vector<GURL>& urls, 244 void DnsPrefetchMotivatedList(const std::vector<GURL>& urls,
239 UrlInfo::ResolutionMotivation motivation); 245 UrlInfo::ResolutionMotivation motivation);
240 246
241 // May be called from either the IO or UI thread and will PostTask 247 // Called from the UI thread in response to the load event.
242 // to the IO thread if necessary.
243 void SaveStateForNextStartup(); 248 void SaveStateForNextStartup();
244 249
245 void SaveDnsPrefetchStateForNextStartup(base::ListValue* startup_list,
246 base::ListValue* referral_list,
247 base::WaitableEvent* completion);
248
249 // May be called from either the IO or UI thread and will PostTask 250 // May be called from either the IO or UI thread and will PostTask
250 // to the IO thread if necessary. 251 // to the IO thread if necessary.
251 void PreconnectUrl(const GURL& url, 252 void PreconnectUrl(const GURL& url,
252 const GURL& first_party_for_cookies, 253 const GURL& first_party_for_cookies,
253 UrlInfo::ResolutionMotivation motivation, 254 UrlInfo::ResolutionMotivation motivation,
254 bool allow_credentials, 255 bool allow_credentials,
255 int count); 256 int count);
256 257
257 void PreconnectUrlOnIOThread(const GURL& url, 258 void PreconnectUrlOnIOThread(const GURL& url,
258 const GURL& first_party_for_cookies, 259 const GURL& first_party_for_cookies,
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 563
563 private: 564 private:
564 // These member functions return True for unittests. 565 // These member functions return True for unittests.
565 bool CanPrefetchAndPrerender() const override; 566 bool CanPrefetchAndPrerender() const override;
566 bool CanPreresolveAndPreconnect() const override; 567 bool CanPreresolveAndPreconnect() const override;
567 }; 568 };
568 569
569 } // namespace chrome_browser_net 570 } // namespace chrome_browser_net
570 571
571 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ 572 #endif // CHROME_BROWSER_NET_PREDICTOR_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/predictor.cc » ('j') | chrome/browser/net/predictor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698