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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 // orginial hostname. | 582 // orginial hostname. |
583 Referrers referrers_; | 583 Referrers referrers_; |
584 | 584 |
585 // List of URLs in referrers_ currently being trimmed (scaled down to | 585 // List of URLs in referrers_ currently being trimmed (scaled down to |
586 // eventually be aged out of use). | 586 // eventually be aged out of use). |
587 std::vector<GURL> urls_being_trimmed_; | 587 std::vector<GURL> urls_being_trimmed_; |
588 | 588 |
589 // A time after which we need to do more trimming of referrers. | 589 // A time after which we need to do more trimming of referrers. |
590 base::TimeTicks next_trim_time_; | 590 base::TimeTicks next_trim_time_; |
591 | 591 |
592 scoped_ptr<base::WeakPtrFactory<Predictor> > weak_factory_; | |
593 | |
594 scoped_ptr<ProxyAdvisor> proxy_advisor_; | 592 scoped_ptr<ProxyAdvisor> proxy_advisor_; |
595 | 593 |
596 // An observer for testing. | 594 // An observer for testing. |
597 PredictorObserver* observer_; | 595 PredictorObserver* observer_; |
598 | 596 |
| 597 scoped_ptr<base::WeakPtrFactory<Predictor> > weak_factory_; |
| 598 |
599 DISALLOW_COPY_AND_ASSIGN(Predictor); | 599 DISALLOW_COPY_AND_ASSIGN(Predictor); |
600 }; | 600 }; |
601 | 601 |
602 // This version of the predictor is used for testing. | 602 // This version of the predictor is used for testing. |
603 class SimplePredictor : public Predictor { | 603 class SimplePredictor : public Predictor { |
604 public: | 604 public: |
605 explicit SimplePredictor(bool preconnect_enabled, bool predictor_enabled) | 605 explicit SimplePredictor(bool preconnect_enabled, bool predictor_enabled) |
606 : Predictor(preconnect_enabled, predictor_enabled) {} | 606 : Predictor(preconnect_enabled, predictor_enabled) {} |
607 virtual ~SimplePredictor() {} | 607 virtual ~SimplePredictor() {} |
608 virtual void InitNetworkPredictor( | 608 virtual void InitNetworkPredictor( |
609 PrefService* user_prefs, | 609 PrefService* user_prefs, |
610 PrefService* local_state, | 610 PrefService* local_state, |
611 IOThread* io_thread, | 611 IOThread* io_thread, |
612 net::URLRequestContextGetter* getter, | 612 net::URLRequestContextGetter* getter, |
613 ProfileIOData* profile_io_data) OVERRIDE; | 613 ProfileIOData* profile_io_data) OVERRIDE; |
614 virtual void ShutdownOnUIThread() OVERRIDE; | 614 virtual void ShutdownOnUIThread() OVERRIDE; |
615 private: | 615 private: |
616 // These member functions return True for unittests. | 616 // These member functions return True for unittests. |
617 virtual bool CanPrefetchAndPrerender() const OVERRIDE; | 617 virtual bool CanPrefetchAndPrerender() const OVERRIDE; |
618 virtual bool CanPreresolveAndPreconnect() const OVERRIDE; | 618 virtual bool CanPreresolveAndPreconnect() const OVERRIDE; |
619 }; | 619 }; |
620 | 620 |
621 } // namespace chrome_browser_net | 621 } // namespace chrome_browser_net |
622 | 622 |
623 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 623 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
OLD | NEW |