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

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: nits 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 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // preconnect to the search server). 151 // preconnect to the search server).
152 void AnticipateOmniboxUrl(const GURL& url, bool preconnectable); 152 void AnticipateOmniboxUrl(const GURL& url, bool preconnectable);
153 153
154 // Preconnect a URL and all of its subresource domains. 154 // Preconnect a URL and all of its subresource domains.
155 void PreconnectUrlAndSubresources(const GURL& url, 155 void PreconnectUrlAndSubresources(const GURL& url,
156 const GURL& first_party_for_cookies); 156 const GURL& first_party_for_cookies);
157 157
158 static std::vector<GURL> GetPredictedUrlListAtStartup( 158 static std::vector<GURL> GetPredictedUrlListAtStartup(
159 PrefService* user_prefs); 159 PrefService* user_prefs);
160 160
161 // Clears the preferences used by the predictor. Must be called on the UI
162 // thread.
163 void ClearPrefsOnUIThread();
164
161 static void set_max_queueing_delay(int max_queueing_delay_ms); 165 static void set_max_queueing_delay(int max_queueing_delay_ms);
162 166
163 static void set_max_parallel_resolves(size_t max_parallel_resolves); 167 static void set_max_parallel_resolves(size_t max_parallel_resolves);
164 168
165 virtual void ShutdownOnUIThread(); 169 virtual void ShutdownOnUIThread();
166 170
167 // ------------- End UI thread methods. 171 // ------------- End UI thread methods.
168 172
169 // ------------- Start IO thread methods. 173 // ------------- Start IO thread methods.
170 174
171 // Cancel pending requests and prevent new ones from being made. 175 // Cancel pending requests and prevent new ones from being made.
172 void Shutdown(); 176 void Shutdown();
173 177
174 // In some circumstances, for privacy reasons, all results should be 178 // In some circumstances, for privacy reasons, all results should be
175 // discarded. This method gracefully handles that activity. 179 // discarded. This method gracefully handles that activity.
176 // Destroy all our internal state, which shows what names we've looked up, and 180 // Destroy all our internal state, which shows what names we've looked up, and
177 // how long each has taken, etc. etc. We also destroy records of suggesses 181 // how long each has taken, etc. etc. We also destroy records of suggesses
178 // (cache hits etc.). 182 // (cache hits etc.).
179 void DiscardAllResults(); 183 void DiscardAllResults();
180 184
185 // Calls DiscardAllResults and posts a task to the UI thread to clear prefs.
186 void DiscardAllResultsAndClearPrefs();
187
181 // Add hostname(s) to the queue for processing. 188 // Add hostname(s) to the queue for processing.
182 void ResolveList(const std::vector<GURL>& urls, 189 void ResolveList(const std::vector<GURL>& urls,
183 UrlInfo::ResolutionMotivation motivation); 190 UrlInfo::ResolutionMotivation motivation);
184 191
185 void Resolve(const GURL& url, UrlInfo::ResolutionMotivation motivation); 192 void Resolve(const GURL& url, UrlInfo::ResolutionMotivation motivation);
186 193
187 // Record details of a navigation so that we can preresolve the host name 194 // Record details of a navigation so that we can preresolve the host name
188 // ahead of time the next time the users navigates to the indicated host. 195 // ahead of time the next time the users navigates to the indicated host.
189 // Should only be called when urls are distinct, and they should already be 196 // Should only be called when urls are distinct, and they should already be
190 // canonicalized to not have a path. 197 // canonicalized to not have a path.
(...skipping 11 matching lines...) Expand all
202 209
203 // Construct a ListValue object that contains all the data in the referrers_ 210 // Construct a ListValue object that contains all the data in the referrers_
204 // so that it can be persisted in a pref. 211 // so that it can be persisted in a pref.
205 void SerializeReferrers(base::ListValue* referral_list); 212 void SerializeReferrers(base::ListValue* referral_list);
206 213
207 // Process a ListValue that contains all the data from a previous reference 214 // Process a ListValue that contains all the data from a previous reference
208 // list, as constructed by SerializeReferrers(), and add all the identified 215 // list, as constructed by SerializeReferrers(), and add all the identified
209 // values into the current referrer list. 216 // values into the current referrer list.
210 void DeserializeReferrers(const base::ListValue& referral_list); 217 void DeserializeReferrers(const base::ListValue& referral_list);
211 218
212 void DeserializeReferrersThenDelete(base::ListValue* referral_list);
213
214 void DiscardInitialNavigationHistory(); 219 void DiscardInitialNavigationHistory();
215 220
216 void FinalizeInitializationOnIOThread( 221 void FinalizeInitializationOnIOThread(
217 const std::vector<GURL>& urls_to_prefetch, 222 const std::vector<GURL>& urls_to_prefetch,
218 base::ListValue* referral_list, 223 const base::ListValue* referral_list,
219 IOThread* io_thread, 224 IOThread* io_thread,
220 ProfileIOData* profile_io_data); 225 ProfileIOData* profile_io_data);
221 226
222 // During startup, we learn what the first N urls visited are, and then 227 // During startup, we learn what the first N urls visited are, and then
223 // resolve the associated hosts ASAP during our next startup. 228 // resolve the associated hosts ASAP during our next startup.
224 void LearnAboutInitialNavigation(const GURL& url); 229 void LearnAboutInitialNavigation(const GURL& url);
225 230
226 // Renderer bundles up list and sends to this browser API via IPC. 231 // Renderer bundles up list and sends to this browser API via IPC.
227 // TODO(csharrison): Use a GURL vector instead to include port and scheme. 232 // TODO(csharrison): Use a GURL vector instead to include port and scheme.
228 void DnsPrefetchList(const std::vector<std::string>& hostnames); 233 void DnsPrefetchList(const std::vector<std::string>& hostnames);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 561
557 private: 562 private:
558 // These member functions return True for unittests. 563 // These member functions return True for unittests.
559 bool CanPrefetchAndPrerender() const override; 564 bool CanPrefetchAndPrerender() const override;
560 bool CanPreresolveAndPreconnect() const override; 565 bool CanPreresolveAndPreconnect() const override;
561 }; 566 };
562 567
563 } // namespace chrome_browser_net 568 } // namespace chrome_browser_net
564 569
565 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ 570 #endif // CHROME_BROWSER_NET_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698