Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // Cancel pending requests and prevent new ones from being made. | 171 // Cancel pending requests and prevent new ones from being made. |
| 172 void Shutdown(); | 172 void Shutdown(); |
| 173 | 173 |
| 174 // In some circumstances, for privacy reasons, all results should be | 174 // In some circumstances, for privacy reasons, all results should be |
| 175 // discarded. This method gracefully handles that activity. | 175 // discarded. This method gracefully handles that activity. |
| 176 // Destroy all our internal state, which shows what names we've looked up, and | 176 // 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 | 177 // how long each has taken, etc. etc. We also destroy records of suggesses |
| 178 // (cache hits etc.). | 178 // (cache hits etc.). |
| 179 void DiscardAllResults(); | 179 void DiscardAllResults(); |
| 180 | 180 |
| 181 // Clears the preferences used by the predictor. Must be called on the UI | |
| 182 // thread. | |
| 183 void ClearPrefsOnUIThread(); | |
|
eroman
2016/06/25 01:12:53
Same comment as earlier -- why not put this above
Charlie Harrison
2016/06/27 18:57:12
Sorry I missed this one. Done.
| |
| 184 | |
| 185 // Calls DiscardAllResults and posts a task to the UI thread to clear prefs. | |
| 186 void DiscardAllResultAndClearPrefs(); | |
|
eroman
2016/06/25 01:12:53
"AllResultAnd" --> "AllResultsAnd"
Charlie Harrison
2016/06/27 18:57:12
The perils of autocomplete :) Done.
| |
| 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 Loading... | |
| 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 Loading... | |
| 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_ |
| OLD | NEW |