OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This is the global interface for the dns prefetch services. It centralizes | 5 // This is the global interface for the dns prefetch services. It centralizes |
6 // initialization, along with all the callbacks etc. to connect to the browser | 6 // initialization, along with all the callbacks etc. to connect to the browser |
7 // process. This allows the more standard DNS prefetching services, such as | 7 // process. This allows the more standard DNS prefetching services, such as |
8 // provided by DnsMaster to be left as more generally usable code, and possibly | 8 // provided by DnsMaster to be left as more generally usable code, and possibly |
9 // be shared across multiple client projects. | 9 // be shared across multiple client projects. |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 void FreeDnsPrefetchResources(); | 35 void FreeDnsPrefetchResources(); |
36 | 36 |
37 // Creates the HostResolver observer for the prefetching system. | 37 // Creates the HostResolver observer for the prefetching system. |
38 net::HostResolver::Observer* CreatePrefetchObserver(); | 38 net::HostResolver::Observer* CreatePrefetchObserver(); |
39 | 39 |
40 //------------------------------------------------------------------------------ | 40 //------------------------------------------------------------------------------ |
41 // Global APIs relating to Prefetching in browser | 41 // Global APIs relating to Prefetching in browser |
42 void EnableDnsPrefetch(bool enable); | 42 void EnableDnsPrefetch(bool enable); |
43 void RegisterPrefs(PrefService* local_state); | 43 void RegisterPrefs(PrefService* local_state); |
44 void RegisterUserPrefs(PrefService* user_prefs); | 44 void RegisterUserPrefs(PrefService* user_prefs); |
| 45 |
45 // Renderer bundles up list and sends to this browser API via IPC. | 46 // Renderer bundles up list and sends to this browser API via IPC. |
46 void DnsPrefetchList(const NameList& hostnames); | 47 void DnsPrefetchList(const NameList& hostnames); |
| 48 |
47 // This API is used by the autocomplete popup box (as user types). | 49 // This API is used by the autocomplete popup box (as user types). |
48 void DnsPrefetchUrl(const GURL& url); | 50 // Search URL's may be "prewarmed" above and beyond the DNS resolution. |
| 51 void DnsPrefetchUrl(const GURL& url, bool is_search_url); |
| 52 |
| 53 // When displaying info in about:dns, the following API is called. |
49 void DnsPrefetchGetHtmlInfo(std::string* output); | 54 void DnsPrefetchGetHtmlInfo(std::string* output); |
50 | 55 |
51 //------------------------------------------------------------------------------ | 56 //------------------------------------------------------------------------------ |
52 void SaveDnsPrefetchStateForNextStartupAndTrim(PrefService* prefs); | 57 void SaveDnsPrefetchStateForNextStartupAndTrim(PrefService* prefs); |
53 // Helper class to handle global init and shutdown. | 58 // Helper class to handle global init and shutdown. |
54 class DnsGlobalInit { | 59 class DnsGlobalInit { |
55 public: | 60 public: |
56 // Too many concurrent lookups negate benefits of prefetching by trashing | 61 // Too many concurrent lookups negate benefits of prefetching by trashing |
57 // the OS cache before all resource loading is complete. | 62 // the OS cache before all resource loading is complete. |
58 // This is the default. | 63 // This is the default. |
59 static const size_t kMaxPrefetchConcurrentLookups; | 64 static const size_t kMaxPrefetchConcurrentLookups; |
60 | 65 |
61 // When prefetch requests are queued beyond some period of time, then the | 66 // When prefetch requests are queued beyond some period of time, then the |
62 // system is congested, and we need to clear all queued requests to get out | 67 // system is congested, and we need to clear all queued requests to get out |
63 // of that state. The following is the suggested default time limit. | 68 // of that state. The following is the suggested default time limit. |
64 static const int kMaxPrefetchQueueingDelayMs; | 69 static const int kMaxPrefetchQueueingDelayMs; |
65 | 70 |
66 DnsGlobalInit(PrefService* user_prefs, PrefService* local_state); | 71 DnsGlobalInit(PrefService* user_prefs, PrefService* local_state); |
67 | 72 |
68 private: | 73 private: |
69 // Maintain a field trial instance when we do A/B testing. | 74 // Maintain a field trial instance when we do A/B testing. |
70 scoped_refptr<FieldTrial> trial_; | 75 scoped_refptr<FieldTrial> trial_; |
71 | 76 |
72 DISALLOW_COPY_AND_ASSIGN(DnsGlobalInit); | 77 DISALLOW_COPY_AND_ASSIGN(DnsGlobalInit); |
73 }; | 78 }; |
74 | 79 |
75 } // namespace chrome_browser_net | 80 } // namespace chrome_browser_net |
76 | 81 |
77 #endif // CHROME_BROWSER_NET_DNS_GLOBAL_H_ | 82 #endif // CHROME_BROWSER_NET_DNS_GLOBAL_H_ |
OLD | NEW |