Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: chrome/browser/net/url_info.h

Issue 9635018: Remove static initializer in url_info.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove const Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/net/url_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 UrlInfo object is used to store prediction related information about a host 5 // A UrlInfo object is used to store prediction related information about a host
6 // port and scheme triplet. When performing DNS pre-resolution of the host/port 6 // port and scheme triplet. When performing DNS pre-resolution of the host/port
7 // pair, its state is monitored as it is resolved. 7 // pair, its state is monitored as it is resolved.
8 // It includes progress, from placement in the Predictor's queue, to resolution 8 // It includes progress, from placement in the Predictor's queue, to resolution
9 // by the DNS service as either FOUND or NO_SUCH_NAME. Each instance may also 9 // by the DNS service as either FOUND or NO_SUCH_NAME. Each instance may also
10 // hold records of previous resolution times, which might later be shown to be 10 // hold records of previous resolution times, which might later be shown to be
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 enum DnsProcessingState { 58 enum DnsProcessingState {
59 // When processed by our prefetching system, the states are: 59 // When processed by our prefetching system, the states are:
60 PENDING, // Constructor has completed. 60 PENDING, // Constructor has completed.
61 QUEUED, // In name queue but not yet being resolved. 61 QUEUED, // In name queue but not yet being resolved.
62 ASSIGNED, // Being resolved (or being reset to earlier state) 62 ASSIGNED, // Being resolved (or being reset to earlier state)
63 ASSIGNED_BUT_MARKED, // Needs to be deleted as soon as it's resolved. 63 ASSIGNED_BUT_MARKED, // Needs to be deleted as soon as it's resolved.
64 FOUND, // DNS resolution completed. 64 FOUND, // DNS resolution completed.
65 NO_SUCH_NAME, // DNS resolution completed. 65 NO_SUCH_NAME, // DNS resolution completed.
66 }; 66 };
67 static const base::TimeDelta kMaxNonNetworkDnsLookupDuration;
68 // The number of OS cache entries we can guarantee(?) before cache eviction
69 // might likely take place.
70 static const int kMaxGuaranteedDnsCacheSize = 50;
71 67
72 typedef std::vector<UrlInfo> UrlInfoTable; 68 typedef std::vector<UrlInfo> UrlInfoTable;
73 69
74 static const base::TimeDelta kNullDuration; 70 static base::TimeDelta NullDuration() {
71 return base::TimeDelta::FromMilliseconds(-1);
72 }
75 73
76 // UrlInfo are usually made by the default constructor during 74 // UrlInfo are usually made by the default constructor during
77 // initializing of the Predictor's map (of info for Hostnames). 75 // initializing of the Predictor's map (of info for Hostnames).
78 UrlInfo(); 76 UrlInfo();
79 77
80 ~UrlInfo(); 78 ~UrlInfo();
81 79
82 // NeedDnsUpdate decides, based on our internal info, 80 // NeedDnsUpdate decides, based on our internal info,
83 // if it would be valuable to attempt to update (prefectch) 81 // if it would be valuable to attempt to update (prefectch)
84 // DNS data for hostname. This decision is based 82 // DNS data for hostname. This decision is based
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // IsStillCached() guesses if the DNS cache still has IP data. 142 // IsStillCached() guesses if the DNS cache still has IP data.
145 bool IsStillCached() const; 143 bool IsStillCached() const;
146 144
147 // Record why we created, or have updated (reqested pre-resolution) of this 145 // Record why we created, or have updated (reqested pre-resolution) of this
148 // instance. 146 // instance.
149 void SetMotivation(ResolutionMotivation motivation); 147 void SetMotivation(ResolutionMotivation motivation);
150 148
151 // Helper function for about:dns printing. 149 // Helper function for about:dns printing.
152 std::string GetAsciiMotivation() const; 150 std::string GetAsciiMotivation() const;
153 151
154 // The next declaration is non-const to facilitate testing.
155 static base::TimeDelta cache_expiration_duration_;
156
157 // The current state of this instance. 152 // The current state of this instance.
158 DnsProcessingState state_; 153 DnsProcessingState state_;
159 154
160 // Record the state prior to going to a queued state, in case we have to back 155 // Record the state prior to going to a queued state, in case we have to back
161 // out of the queue. 156 // out of the queue.
162 DnsProcessingState old_prequeue_state_; 157 DnsProcessingState old_prequeue_state_;
163 158
164 GURL url_; // Host, port and scheme for this info. 159 GURL url_; // Host, port and scheme for this info.
165 160
166 // When was last state changed (usually lookup completed). 161 // When was last state changed (usually lookup completed).
(...skipping 18 matching lines...) Expand all
185 GURL referring_url_; 180 GURL referring_url_;
186 181
187 // We put these objects into a std::map, and hence we 182 // We put these objects into a std::map, and hence we
188 // need some "evil" constructors. 183 // need some "evil" constructors.
189 // DISALLOW_COPY_AND_ASSIGN(UrlInfo); 184 // DISALLOW_COPY_AND_ASSIGN(UrlInfo);
190 }; 185 };
191 186
192 } // namespace chrome_browser_net 187 } // namespace chrome_browser_net
193 188
194 #endif // CHROME_BROWSER_NET_URL_INFO_H_ 189 #endif // CHROME_BROWSER_NET_URL_INFO_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/predictor_unittest.cc ('k') | chrome/browser/net/url_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698