| 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 30 matching lines...) Expand all Loading... |
| 41 class WaitableEvent; | 41 class WaitableEvent; |
| 42 } | 42 } |
| 43 | 43 |
| 44 namespace net { | 44 namespace net { |
| 45 class HostResolver; | 45 class HostResolver; |
| 46 class URLRequestContextGetter; | 46 class URLRequestContextGetter; |
| 47 } // namespace net | 47 } // namespace net |
| 48 | 48 |
| 49 class IOThread; | 49 class IOThread; |
| 50 class PrefService; | 50 class PrefService; |
| 51 class PrefServiceSyncable; |
| 51 class Profile; | 52 class Profile; |
| 52 | 53 |
| 53 namespace chrome_browser_net { | 54 namespace chrome_browser_net { |
| 54 | 55 |
| 55 typedef chrome_common_net::UrlList UrlList; | 56 typedef chrome_common_net::UrlList UrlList; |
| 56 typedef chrome_common_net::NameList NameList; | 57 typedef chrome_common_net::NameList NameList; |
| 57 typedef std::map<GURL, UrlInfo> Results; | 58 typedef std::map<GURL, UrlInfo> Results; |
| 58 | 59 |
| 59 // Predictor is constructed during Profile construction (on the UI thread), | 60 // Predictor is constructed during Profile construction (on the UI thread), |
| 60 // 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 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // be performed. Host lookups will be issued through |host_resolver|. | 95 // be performed. Host lookups will be issued through |host_resolver|. |
| 95 explicit Predictor(bool preconnect_enabled); | 96 explicit Predictor(bool preconnect_enabled); |
| 96 | 97 |
| 97 virtual ~Predictor(); | 98 virtual ~Predictor(); |
| 98 | 99 |
| 99 // 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 |
| 100 // a version which does a simpler shutdown. | 101 // a version which does a simpler shutdown. |
| 101 static Predictor* CreatePredictor(bool preconnect_enabled, | 102 static Predictor* CreatePredictor(bool preconnect_enabled, |
| 102 bool simple_shutdown); | 103 bool simple_shutdown); |
| 103 | 104 |
| 104 static void RegisterUserPrefs(PrefService* user_prefs); | 105 static void RegisterUserPrefs(PrefServiceSyncable* user_prefs); |
| 105 | 106 |
| 106 // ------------- Start UI thread methods. | 107 // ------------- Start UI thread methods. |
| 107 | 108 |
| 108 virtual void InitNetworkPredictor(PrefService* user_prefs, | 109 virtual void InitNetworkPredictor(PrefService* user_prefs, |
| 109 PrefService* local_state, | 110 PrefService* local_state, |
| 110 IOThread* io_thread, | 111 IOThread* io_thread, |
| 111 net::URLRequestContextGetter* getter); | 112 net::URLRequestContextGetter* getter); |
| 112 | 113 |
| 113 // 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 |
| 114 // 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... |
| 513 PrefService* user_prefs, | 514 PrefService* user_prefs, |
| 514 PrefService* local_state, | 515 PrefService* local_state, |
| 515 IOThread* io_thread, | 516 IOThread* io_thread, |
| 516 net::URLRequestContextGetter* getter) OVERRIDE; | 517 net::URLRequestContextGetter* getter) OVERRIDE; |
| 517 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; | 518 virtual void ShutdownOnUIThread(PrefService* user_prefs) OVERRIDE; |
| 518 }; | 519 }; |
| 519 | 520 |
| 520 } // namespace chrome_browser_net | 521 } // namespace chrome_browser_net |
| 521 | 522 |
| 522 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ | 523 #endif // CHROME_BROWSER_NET_PREDICTOR_H_ |
| OLD | NEW |