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

Side by Side Diff: net/dns/dns_util.h

Issue 1908543002: DNS: Retain stale entries in HostCache and return when requested (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, tweak histograms a bit Created 4 years, 8 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
« no previous file with comments | « no previous file | net/dns/dns_util.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) 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 #ifndef NET_DNS_DNS_UTIL_H_ 5 #ifndef NET_DNS_DNS_UTIL_H_
6 #define NET_DNS_DNS_UTIL_H_ 6 #define NET_DNS_DNS_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/base/network_change_notifier.h" 13 #include "net/base/network_change_notifier.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class AddressList;
18
17 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's 19 // DNSDomainFromDot - convert a domain string to DNS format. From DJB's
18 // public domain DNS library. 20 // public domain DNS library.
19 // 21 //
20 // dotted: a string in dotted form: "www.google.com" 22 // dotted: a string in dotted form: "www.google.com"
21 // out: a result in DNS form: "\x03www\x06google\x03com\x00" 23 // out: a result in DNS form: "\x03www\x06google\x03com\x00"
22 NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted, 24 NET_EXPORT_PRIVATE bool DNSDomainFromDot(const base::StringPiece& dotted,
23 std::string* out); 25 std::string* out);
24 26
25 // DNSDomainToString converts a domain in DNS format to a dotted string. 27 // DNSDomainToString converts a domain in DNS format to a dotted string.
26 // Excludes the dot at the end. 28 // Excludes the dot at the end.
27 NET_EXPORT_PRIVATE std::string DNSDomainToString( 29 NET_EXPORT_PRIVATE std::string DNSDomainToString(
28 const base::StringPiece& domain); 30 const base::StringPiece& domain);
29 31
30 // Returns true if it can determine that only loopback addresses are configured. 32 // Returns true if it can determine that only loopback addresses are configured.
31 // i.e. if only 127.0.0.1 and ::1 are routable. 33 // i.e. if only 127.0.0.1 and ::1 are routable.
32 // Also returns false if it cannot determine this. 34 // Also returns false if it cannot determine this.
33 NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses(); 35 NET_EXPORT_PRIVATE bool HaveOnlyLoopbackAddresses();
34 36
35 #if !defined(OS_NACL) 37 #if !defined(OS_NACL)
36 NET_EXPORT_PRIVATE 38 NET_EXPORT_PRIVATE
37 base::TimeDelta GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault( 39 base::TimeDelta GetTimeDeltaForConnectionTypeFromFieldTrialOrDefault(
38 const char* field_trial_name, 40 const char* field_trial_name,
39 base::TimeDelta default_delta, 41 base::TimeDelta default_delta,
40 NetworkChangeNotifier::ConnectionType connection_type); 42 NetworkChangeNotifier::ConnectionType connection_type);
41 #endif // !defined(OS_NACL) 43 #endif // !defined(OS_NACL)
42 44
45 // Used in histograms; please only insert new entries before MAX.
Ryan Sleevi 2016/04/26 02:18:22 Comment nit: While politeness is a virtue, it leav
Ryan Sleevi 2016/04/26 02:18:22 Comment nit: This doesn't explain the type // The
Ryan Sleevi 2016/04/26 02:18:22 If they're used in histograms, you should add expl
Julia Tuttle 2016/04/27 14:47:04 Done (all three; the new rietveld UI won't let me
46 enum AddressListDeltaType {
47 // a and b contain the same addresses in the same order.
Ryan Sleevi 2016/04/26 02:18:22 nit: "a" and "b" are not defined here (they're an
Julia Tuttle 2016/04/27 14:47:04 Done.
48 DELTA_IDENTICAL,
49 // a and b contain the same addresses in a different order.
50 DELTA_REORDERED,
51 // a and b have at least one address in common, but not all of them.
52 DELTA_OVERLAP,
53 // a and b have no addresses in common.
54 DELTA_DISJOINT,
55 MAX_DELTA_TYPE
Ryan Sleevi 2016/04/26 02:18:22 naming: Given that you adopted ENUM_PREFIX naming,
Julia Tuttle 2016/04/27 14:47:04 I usually make an exception for the max value cons
56 };
57
58 AddressListDeltaType FindAddressListDeltaType(const AddressList& a,
Ryan Sleevi 2016/04/26 02:18:22 Document? :)
Julia Tuttle 2016/04/27 14:47:04 Done (the new rietveld UI has no button for this :
59 const AddressList& b);
60
43 } // namespace net 61 } // namespace net
44 62
45 #endif // NET_DNS_DNS_UTIL_H_ 63 #endif // NET_DNS_DNS_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | net/dns/dns_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698