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 10 matching lines...) Expand all Loading... |
21 | 21 |
22 #include <map> | 22 #include <map> |
23 #include <queue> | 23 #include <queue> |
24 #include <set> | 24 #include <set> |
25 #include <string> | 25 #include <string> |
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/url_info.h" | 32 #include "chrome/browser/net/url_info.h" |
32 #include "chrome/browser/net/referrer.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 namespace base { | 36 namespace base { |
37 class ListValue; | 37 class ListValue; |
38 } | 38 } |
39 | 39 |
40 namespace base { | 40 namespace base { |
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 PrefRegistrySyncable; |
52 class Profile; | 52 class Profile; |
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 |
(...skipping 33 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(PrefServiceSyncable* user_prefs); | 105 static void RegisterUserPrefs(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 |