| Index: chrome/browser/net/predictor.h
|
| diff --git a/chrome/browser/net/predictor.h b/chrome/browser/net/predictor.h
|
| index 2e6f811811e3ca1c36e414b44146f375d47ccd0b..aee741acb792903b163d9c2847f498c1645b5d7c 100644
|
| --- a/chrome/browser/net/predictor.h
|
| +++ b/chrome/browser/net/predictor.h
|
| @@ -38,6 +38,7 @@
|
| #include "chrome/browser/net/url_info.h"
|
| #include "components/network_hints/common/network_hints_common.h"
|
| #include "net/base/host_port_pair.h"
|
| +#include "url/gurl.h"
|
|
|
| class IOThread;
|
| class PrefService;
|
| @@ -75,7 +76,9 @@ class PredictorObserver {
|
| virtual void OnPreconnectUrl(const GURL& original_url,
|
| const GURL& first_party_for_cookies,
|
| UrlInfo::ResolutionMotivation motivation,
|
| - int count) = 0;
|
| + int count) {}
|
| + virtual void OnLearnFromNavigation(const GURL& referring_url,
|
| + const GURL& target_url) {}
|
| };
|
|
|
| // Predictor is constructed during Profile construction (on the UI thread),
|
| @@ -300,6 +303,7 @@ class Predictor {
|
| }
|
|
|
| bool preconnect_enabled() const {
|
| + base::AutoLock lock(lock_);
|
| return preconnect_enabled_;
|
| }
|
|
|
| @@ -307,6 +311,12 @@ class Predictor {
|
| return predictor_enabled_;
|
| }
|
|
|
| + // Used only for testing. Overrides command line flag to disable preconnect,
|
| + // which is added in the browser test fixture.
|
| + void set_preconnect_enabled_for_test(bool preconnect_enabled) {
|
| + base::AutoLock lock(lock_);
|
| + preconnect_enabled_ = preconnect_enabled;
|
| + }
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(PredictorTest, BenefitLookupTest);
|
| @@ -564,7 +574,7 @@ class Predictor {
|
| // Are we currently using preconnection, rather than just DNS resolution, for
|
| // subresources and omni-box search URLs.
|
| // This is false if and only if disabled by a command line switch.
|
| - const bool preconnect_enabled_;
|
| + bool preconnect_enabled_;
|
|
|
| // Most recent suggestion from Omnibox provided via AnticipateOmniboxUrl().
|
| std::string last_omnibox_host_;
|
| @@ -597,6 +607,8 @@ class Predictor {
|
|
|
| std::unique_ptr<base::WeakPtrFactory<Predictor>> weak_factory_;
|
|
|
| + mutable base::Lock lock_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(Predictor);
|
| };
|
|
|
|
|