| 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 15 matching lines...) Expand all Loading... |
| 26 #include <vector> | 26 #include <vector> |
| 27 | 27 |
| 28 #include "base/gtest_prod_util.h" | 28 #include "base/gtest_prod_util.h" |
| 29 #include "base/memory/scoped_ptr.h" | 29 #include "base/memory/scoped_ptr.h" |
| 30 #include "base/memory/weak_ptr.h" | 30 #include "base/memory/weak_ptr.h" |
| 31 #include "chrome/browser/net/referrer.h" | 31 #include "chrome/browser/net/referrer.h" |
| 32 #include "chrome/browser/net/url_info.h" | 32 #include "chrome/browser/net/url_info.h" |
| 33 #include "chrome/common/net/predictor_common.h" | 33 #include "chrome/common/net/predictor_common.h" |
| 34 #include "net/base/host_port_pair.h" | 34 #include "net/base/host_port_pair.h" |
| 35 | 35 |
| 36 class IOThread; |
| 37 class PrefService; |
| 38 class Profile; |
| 39 |
| 36 namespace base { | 40 namespace base { |
| 37 class ListValue; | 41 class ListValue; |
| 38 } | |
| 39 | |
| 40 namespace base { | |
| 41 class WaitableEvent; | 42 class WaitableEvent; |
| 42 } | 43 } |
| 43 | 44 |
| 44 namespace net { | 45 namespace net { |
| 45 class HostResolver; | 46 class HostResolver; |
| 46 class URLRequestContextGetter; | 47 class URLRequestContextGetter; |
| 47 } // namespace net | 48 } |
| 48 | 49 |
| 49 class IOThread; | 50 namespace user_prefs { |
| 50 class PrefService; | |
| 51 class PrefRegistrySyncable; | 51 class PrefRegistrySyncable; |
| 52 class Profile; | 52 } |
| 53 | 53 |
| 54 namespace chrome_browser_net { | 54 namespace chrome_browser_net { |
| 55 | 55 |
| 56 typedef chrome_common_net::UrlList UrlList; | 56 typedef chrome_common_net::UrlList UrlList; |
| 57 typedef chrome_common_net::NameList NameList; | 57 typedef chrome_common_net::NameList NameList; |
| 58 typedef std::map<GURL, UrlInfo> Results; | 58 typedef std::map<GURL, UrlInfo> Results; |
| 59 | 59 |
| 60 // Predictor is constructed during Profile construction (on the UI thread), | 60 // Predictor is constructed during Profile construction (on the UI thread), |
| 61 // but it is destroyed on the IO thread when ProfileIOData goes away. All of | 61 // but it is destroyed on the IO thread when ProfileIOData goes away. All of |
| 62 // its core state and functionality happens on the IO thread. The only UI | 62 // its core state and functionality happens on the IO thread. The only UI |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // be performed. Host lookups will be issued through |host_resolver|. | 95 // be performed. Host lookups will be issued through |host_resolver|. |
| 96 explicit Predictor(bool preconnect_enabled); | 96 explicit Predictor(bool preconnect_enabled); |
| 97 | 97 |
| 98 virtual ~Predictor(); | 98 virtual ~Predictor(); |
| 99 | 99 |
| 100 // This function is used to create a predictor. For testing, we can create | 100 // This function is used to create a predictor. For testing, we can create |
| 101 // a version which does a simpler shutdown. | 101 // a version which does a simpler shutdown. |
| 102 static Predictor* CreatePredictor(bool preconnect_enabled, | 102 static Predictor* CreatePredictor(bool preconnect_enabled, |
| 103 bool simple_shutdown); | 103 bool simple_shutdown); |
| 104 | 104 |
| 105 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 105 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
| 106 | 106 |
| 107 // ------------- Start UI thread methods. | 107 // ------------- Start UI thread methods. |
| 108 | 108 |
| 109 virtual void InitNetworkPredictor(PrefService* user_prefs, | 109 virtual void InitNetworkPredictor(PrefService* user_prefs, |
| 110 PrefService* local_state, | 110 PrefService* local_state, |
| 111 IOThread* io_thread, | 111 IOThread* io_thread, |
| 112 net::URLRequestContextGetter* getter); | 112 net::URLRequestContextGetter* getter); |
| 113 | 113 |
| 114 // The Omnibox has proposed a given url to the user, and if it is a search | 114 // The Omnibox has proposed a given url to the user, and if it is a search |
| 115 // URL, then it also indicates that this is preconnectable (i.e., we could | 115 // URL, then it also indicates that this is preconnectable (i.e., we could |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 PrefService* user_prefs, | 514 PrefService* user_prefs, |
| 515 PrefService* local_state, | 515 PrefService* local_state, |
| 516 IOThread* io_thread, | 516 IOThread* io_thread, |
| 517 net::URLRequestContextGetter* getter) OVERRIDE; | 517 net::URLRequestContextGetter* getter) OVERRIDE; |
| 518 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; | 518 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; |
| 519 }; | 519 }; |
| 520 | 520 |
| 521 } // namespace chrome_browser_net | 521 } // namespace chrome_browser_net |
| 522 | 522 |
| 523 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 523 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
| OLD | NEW |