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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
428 // Only for testing; | 428 // Only for testing; |
429 size_t peak_pending_lookups() const { return peak_pending_lookups_; } | 429 size_t peak_pending_lookups() const { return peak_pending_lookups_; } |
430 | 430 |
431 // If a proxy advisor is defined, let it know that |url| will be prefetched or | 431 // If a proxy advisor is defined, let it know that |url| will be prefetched or |
432 // preconnected to. Can be called on either UI or IO threads and will post to | 432 // preconnected to. Can be called on either UI or IO threads and will post to |
433 // the IO thread if necessary, invoking AdviseProxyOnIOThread(). | 433 // the IO thread if necessary, invoking AdviseProxyOnIOThread(). |
434 void AdviseProxy(const GURL& url, | 434 void AdviseProxy(const GURL& url, |
435 UrlInfo::ResolutionMotivation motivation, | 435 UrlInfo::ResolutionMotivation motivation, |
436 bool is_preconnect); | 436 bool is_preconnect); |
437 | 437 |
438 // There two members call the corresponding global functions in | 438 // These four members call the corresponding global functions in |
439 // prediction_options.cc. | 439 // prediction_options.cc. |
440 virtual bool CanPredictNetworkActionsUI(); | 440 virtual bool CanPredictNetworkActionsUI(); |
441 virtual bool CanPredictNetworkActionsIO(); | 441 virtual bool CanPredictNetworkActionsIO(); |
442 virtual bool CanPreconnectUI(); | |
443 virtual bool CanPreconnectIO(); | |
mmenke
2014/08/08 16:05:42
nit: All 4 of these should be const.
Bence
2014/08/08 20:10:03
Done.
| |
442 | 444 |
443 // ------------- Start IO thread methods. | 445 // ------------- Start IO thread methods. |
444 | 446 |
445 // Perform actual resolution or preconnection to subresources now. This is | 447 // Perform actual resolution or preconnection to subresources now. This is |
446 // an internal worker method that is reached via a post task from | 448 // an internal worker method that is reached via a post task from |
447 // PredictFrameSubresources(). | 449 // PredictFrameSubresources(). |
448 void PrepareFrameSubresources(const GURL& url, | 450 void PrepareFrameSubresources(const GURL& url, |
449 const GURL& first_party_for_cookies); | 451 const GURL& first_party_for_cookies); |
450 | 452 |
451 // Access method for use by async lookup request to pass resolution result. | 453 // Access method for use by async lookup request to pass resolution result. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
606 : Predictor(preconnect_enabled, predictor_enabled) {} | 608 : Predictor(preconnect_enabled, predictor_enabled) {} |
607 virtual ~SimplePredictor() {} | 609 virtual ~SimplePredictor() {} |
608 virtual void InitNetworkPredictor( | 610 virtual void InitNetworkPredictor( |
609 PrefService* user_prefs, | 611 PrefService* user_prefs, |
610 PrefService* local_state, | 612 PrefService* local_state, |
611 IOThread* io_thread, | 613 IOThread* io_thread, |
612 net::URLRequestContextGetter* getter, | 614 net::URLRequestContextGetter* getter, |
613 ProfileIOData* profile_io_data) OVERRIDE; | 615 ProfileIOData* profile_io_data) OVERRIDE; |
614 virtual void ShutdownOnUIThread() OVERRIDE; | 616 virtual void ShutdownOnUIThread() OVERRIDE; |
615 private: | 617 private: |
616 // There member functions return True for unittests. | 618 // These member functions return True for unittests. |
617 virtual bool CanPredictNetworkActionsUI() OVERRIDE; | 619 virtual bool CanPredictNetworkActionsUI() OVERRIDE; |
618 virtual bool CanPredictNetworkActionsIO() OVERRIDE; | 620 virtual bool CanPredictNetworkActionsIO() OVERRIDE; |
621 virtual bool CanPreconnectUI() OVERRIDE; | |
622 virtual bool CanPreconnectIO() OVERRIDE; | |
619 }; | 623 }; |
620 | 624 |
621 } // namespace chrome_browser_net | 625 } // namespace chrome_browser_net |
622 | 626 |
623 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 627 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
OLD | NEW |