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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 void RegisterUserPrefs(PrefService* user_prefs); | 50 void RegisterUserPrefs(PrefService* user_prefs); |
51 // Renderer bundles up list and sends to this browser API via IPC. | 51 // Renderer bundles up list and sends to this browser API via IPC. |
52 void DnsPrefetchList(const NameList& hostnames); | 52 void DnsPrefetchList(const NameList& hostnames); |
53 // This API is used by the autocomplete popup box (as user types). | 53 // This API is used by the autocomplete popup box (as user types). |
54 void DnsPrefetchUrl(const GURL& url); | 54 void DnsPrefetchUrl(const GURL& url); |
55 void DnsPrefetchGetHtmlInfo(std::string* output); | 55 void DnsPrefetchGetHtmlInfo(std::string* output); |
56 | 56 |
57 //------------------------------------------------------------------------------ | 57 //------------------------------------------------------------------------------ |
58 void SaveDnsPrefetchStateForNextStartupAndTrim(PrefService* prefs); | 58 void SaveDnsPrefetchStateForNextStartupAndTrim(PrefService* prefs); |
59 // Helper class to handle global init and shutdown. | 59 // Helper class to handle global init and shutdown. |
60 class DnsPrefetcherInit { | 60 class DnsGlobalInit { |
61 public: | 61 public: |
62 // Too many concurrent lookups negate benefits of prefetching by trashing | 62 // Too many concurrent lookups negate benefits of prefetching by trashing |
63 // the OS cache before all resource loading is complete. | 63 // the OS cache before all resource loading is complete. |
64 // This is the default. | 64 // This is the default. |
65 static const size_t kMaxConcurrentLookups; | 65 static const size_t kMaxPrefetchConcurrentLookups; |
66 | 66 |
67 // When prefetch requests are queued beyond some period of time, then the | 67 // When prefetch requests are queued beyond some period of time, then the |
68 // system is congested, and we need to clear all queued requests to get out | 68 // system is congested, and we need to clear all queued requests to get out |
69 // of that state. The following is the suggested default time limit. | 69 // of that state. The following is the suggested default time limit. |
70 static const int kMaxQueueingDelayMs; | 70 static const int kMaxPrefetchQueueingDelayMs; |
71 | 71 |
72 DnsPrefetcherInit(PrefService* user_prefs, PrefService* local_state); | 72 DnsGlobalInit(PrefService* user_prefs, PrefService* local_state); |
73 ~DnsPrefetcherInit(); | 73 ~DnsGlobalInit(); |
74 | 74 |
75 private: | 75 private: |
76 // Maintain a field trial instance when we do A/B testing. | 76 // Maintain a field trial instance when we do A/B testing. |
77 scoped_refptr<FieldTrial> trial_; | 77 scoped_refptr<FieldTrial> trial_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(DnsPrefetcherInit); | 79 DISALLOW_COPY_AND_ASSIGN(DnsGlobalInit); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace chrome_browser_net | 82 } // namespace chrome_browser_net |
83 | 83 |
84 #endif // CHROME_BROWSER_NET_DNS_GLOBAL_H_ | 84 #endif // CHROME_BROWSER_NET_DNS_GLOBAL_H_ |
OLD | NEW |