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

Side by Side Diff: chrome/browser/net/predictor.h

Issue 2085643002: Don't clear the net predictors prefs on startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dont clear prefs on startup Created 4 years, 6 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
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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 static std::vector<GURL> GetPredictedUrlListAtStartup( 154 static std::vector<GURL> GetPredictedUrlListAtStartup(
155 PrefService* user_prefs); 155 PrefService* user_prefs);
156 156
157 static void set_max_queueing_delay(int max_queueing_delay_ms); 157 static void set_max_queueing_delay(int max_queueing_delay_ms);
158 158
159 static void set_max_parallel_resolves(size_t max_parallel_resolves); 159 static void set_max_parallel_resolves(size_t max_parallel_resolves);
160 160
161 virtual void ShutdownOnUIThread(); 161 virtual void ShutdownOnUIThread();
162 162
163 // ------------- End UI thread methods. 163 // ------------- End UI thread methods.
eroman 2016/06/23 23:48:05 Based on this comment, I would expect ClearPrefsOn
Charlie Harrison 2016/06/24 00:00:52 Ack.
164 164
165 // ------------- Start IO thread methods. 165 // ------------- Start IO thread methods.
166 166
167 // Cancel pending requests and prevent new ones from being made. 167 // Cancel pending requests and prevent new ones from being made.
168 void Shutdown(); 168 void Shutdown();
169 169
170 // In some circumstances, for privacy reasons, all results should be 170 // In some circumstances, for privacy reasons, all results should be
171 // discarded. This method gracefully handles that activity. 171 // discarded. This method gracefully handles that activity.
172 // Destroy all our internal state, which shows what names we've looked up, and 172 // Destroy all our internal state, which shows what names we've looked up, and
173 // how long each has taken, etc. etc. We also destroy records of suggesses 173 // how long each has taken, etc. etc. We also destroy records of suggesses
174 // (cache hits etc.). 174 // (cache hits etc.).
175 void DiscardAllResults(); 175 void DiscardAllResults();
176 176
177 // Clears the preferences used by the predictor. Must be called on the UI
178 // thread.
179 void ClearPrefsOnUIThread();
180
177 // Add hostname(s) to the queue for processing. 181 // Add hostname(s) to the queue for processing.
178 void ResolveList(const std::vector<GURL>& urls, 182 void ResolveList(const std::vector<GURL>& urls,
179 UrlInfo::ResolutionMotivation motivation); 183 UrlInfo::ResolutionMotivation motivation);
180 184
181 void Resolve(const GURL& url, UrlInfo::ResolutionMotivation motivation); 185 void Resolve(const GURL& url, UrlInfo::ResolutionMotivation motivation);
182 186
183 // Record details of a navigation so that we can preresolve the host name 187 // Record details of a navigation so that we can preresolve the host name
184 // ahead of time the next time the users navigates to the indicated host. 188 // ahead of time the next time the users navigates to the indicated host.
185 // Should only be called when urls are distinct, and they should already be 189 // Should only be called when urls are distinct, and they should already be
186 // canonicalized to not have a path. 190 // canonicalized to not have a path.
(...skipping 19 matching lines...) Expand all
206 210
207 // Construct a ListValue object that contains all the data in the referrers_ 211 // Construct a ListValue object that contains all the data in the referrers_
208 // so that it can be persisted in a pref. 212 // so that it can be persisted in a pref.
209 void SerializeReferrers(base::ListValue* referral_list); 213 void SerializeReferrers(base::ListValue* referral_list);
210 214
211 // Process a ListValue that contains all the data from a previous reference 215 // Process a ListValue that contains all the data from a previous reference
212 // list, as constructed by SerializeReferrers(), and add all the identified 216 // list, as constructed by SerializeReferrers(), and add all the identified
213 // values into the current referrer list. 217 // values into the current referrer list.
214 void DeserializeReferrers(const base::ListValue& referral_list); 218 void DeserializeReferrers(const base::ListValue& referral_list);
215 219
216 void DeserializeReferrersThenDelete(base::ListValue* referral_list);
217
218 void DiscardInitialNavigationHistory(); 220 void DiscardInitialNavigationHistory();
219 221
220 void FinalizeInitializationOnIOThread( 222 void FinalizeInitializationOnIOThread(
221 const std::vector<GURL>& urls_to_prefetch, 223 const std::vector<GURL>& urls_to_prefetch,
222 base::ListValue* referral_list, 224 const base::ListValue* referral_list,
223 IOThread* io_thread, 225 IOThread* io_thread,
224 ProfileIOData* profile_io_data); 226 ProfileIOData* profile_io_data);
225 227
226 // During startup, we learn what the first N urls visited are, and then 228 // During startup, we learn what the first N urls visited are, and then
227 // resolve the associated hosts ASAP during our next startup. 229 // resolve the associated hosts ASAP during our next startup.
228 void LearnAboutInitialNavigation(const GURL& url); 230 void LearnAboutInitialNavigation(const GURL& url);
229 231
230 // Renderer bundles up list and sends to this browser API via IPC. 232 // Renderer bundles up list and sends to this browser API via IPC.
231 // TODO(csharrison): Use a GURL vector instead to include port and scheme. 233 // TODO(csharrison): Use a GURL vector instead to include port and scheme.
232 void DnsPrefetchList(const std::vector<std::string>& hostnames); 234 void DnsPrefetchList(const std::vector<std::string>& hostnames);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 601
600 private: 602 private:
601 // These member functions return True for unittests. 603 // These member functions return True for unittests.
602 bool CanPrefetchAndPrerender() const override; 604 bool CanPrefetchAndPrerender() const override;
603 bool CanPreresolveAndPreconnect() const override; 605 bool CanPreresolveAndPreconnect() const override;
604 }; 606 };
605 607
606 } // namespace chrome_browser_net 608 } // namespace chrome_browser_net
607 609
608 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ 610 #endif // CHROME_BROWSER_NET_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698