| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Calls ClearPrefsOnUIThread and posts a task to the IO thread to |
| 162 // DiscardAllResults. |
| 163 void DiscardAllResultsAndClearPrefsOnUIThread(); |
| 164 |
| 165 // Clears the preferences used by the predictor. Must be called on the UI |
| 166 // thread. |
| 167 void ClearPrefsOnUIThread(); |
| 168 |
| 161 static void set_max_queueing_delay(int max_queueing_delay_ms); | 169 static void set_max_queueing_delay(int max_queueing_delay_ms); |
| 162 | 170 |
| 163 static void set_max_parallel_resolves(size_t max_parallel_resolves); | 171 static void set_max_parallel_resolves(size_t max_parallel_resolves); |
| 164 | 172 |
| 165 virtual void ShutdownOnUIThread(); | 173 virtual void ShutdownOnUIThread(); |
| 166 | 174 |
| 167 // ------------- End UI thread methods. | 175 // ------------- End UI thread methods. |
| 168 | 176 |
| 169 // ------------- Start IO thread methods. | 177 // ------------- Start IO thread methods. |
| 170 | 178 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 210 |
| 203 // 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_ |
| 204 // so that it can be persisted in a pref. | 212 // so that it can be persisted in a pref. |
| 205 void SerializeReferrers(base::ListValue* referral_list); | 213 void SerializeReferrers(base::ListValue* referral_list); |
| 206 | 214 |
| 207 // 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 |
| 208 // list, as constructed by SerializeReferrers(), and add all the identified | 216 // list, as constructed by SerializeReferrers(), and add all the identified |
| 209 // values into the current referrer list. | 217 // values into the current referrer list. |
| 210 void DeserializeReferrers(const base::ListValue& referral_list); | 218 void DeserializeReferrers(const base::ListValue& referral_list); |
| 211 | 219 |
| 212 void DeserializeReferrersThenDelete(base::ListValue* referral_list); | |
| 213 | |
| 214 void DiscardInitialNavigationHistory(); | 220 void DiscardInitialNavigationHistory(); |
| 215 | 221 |
| 216 void FinalizeInitializationOnIOThread( | 222 void FinalizeInitializationOnIOThread( |
| 217 const std::vector<GURL>& urls_to_prefetch, | 223 const std::vector<GURL>& urls_to_prefetch, |
| 218 base::ListValue* referral_list, | 224 std::unique_ptr<base::ListValue> referral_list, |
| 219 IOThread* io_thread, | 225 IOThread* io_thread, |
| 220 ProfileIOData* profile_io_data); | 226 ProfileIOData* profile_io_data); |
| 221 | 227 |
| 222 // 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 |
| 223 // resolve the associated hosts ASAP during our next startup. | 229 // resolve the associated hosts ASAP during our next startup. |
| 224 void LearnAboutInitialNavigation(const GURL& url); | 230 void LearnAboutInitialNavigation(const GURL& url); |
| 225 | 231 |
| 226 // 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. |
| 227 // 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. |
| 228 void DnsPrefetchList(const std::vector<std::string>& hostnames); | 234 void DnsPrefetchList(const std::vector<std::string>& hostnames); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 562 |
| 557 private: | 563 private: |
| 558 // These member functions return True for unittests. | 564 // These member functions return True for unittests. |
| 559 bool CanPrefetchAndPrerender() const override; | 565 bool CanPrefetchAndPrerender() const override; |
| 560 bool CanPreresolveAndPreconnect() const override; | 566 bool CanPreresolveAndPreconnect() const override; |
| 561 }; | 567 }; |
| 562 | 568 |
| 563 } // namespace chrome_browser_net | 569 } // namespace chrome_browser_net |
| 564 | 570 |
| 565 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 571 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
| OLD | NEW |