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 // See header file for description of RendererDnsPrefetch class | 5 // See header file for description of RendererDnsPrefetch class |
6 | 6 |
7 #include "components/network_hints/renderer/renderer_dns_prefetch.h" | 7 #include "components/network_hints/renderer/renderer_dns_prefetch.h" |
8 | 8 |
9 #include <ctype.h> | 9 #include <ctype.h> |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (1 == max_count) break; | 139 if (1 == max_count) break; |
140 --max_count; | 140 --max_count; |
141 DCHECK_GE(max_count, 1u); | 141 DCHECK_GE(max_count, 1u); |
142 } | 142 } |
143 } | 143 } |
144 DCHECK_GE(new_name_count_, names.size()); | 144 DCHECK_GE(new_name_count_, names.size()); |
145 new_name_count_ -= names.size(); | 145 new_name_count_ -= names.size(); |
146 | 146 |
147 network_hints::LookupRequest request; | 147 network_hints::LookupRequest request; |
148 request.hostname_list = names; | 148 request.hostname_list = names; |
149 RenderThread::Get()->Send(new DnsPrefetchMsg_RequestPrefetch(request)); | 149 RenderThread::Get()->Send(new NetworkHintsMsg_DNSPrefetch(request)); |
150 } | 150 } |
151 | 151 |
152 // is_numeric_ip() checks to see if all characters in name are either numeric, | 152 // is_numeric_ip() checks to see if all characters in name are either numeric, |
153 // or dots. Such a name will not actually be passed to DNS, as it is an IP | 153 // or dots. Such a name will not actually be passed to DNS, as it is an IP |
154 // address. | 154 // address. |
155 bool RendererDnsPrefetch::is_numeric_ip(const char* name, size_t length) { | 155 bool RendererDnsPrefetch::is_numeric_ip(const char* name, size_t length) { |
156 // Scan for a character outside our lookup list. | 156 // Scan for a character outside our lookup list. |
157 while (length-- > 0) { | 157 while (length-- > 0) { |
158 if (!isdigit(*name) && '.' != *name) | 158 if (!isdigit(*name) && '.' != *name) |
159 return false; | 159 return false; |
160 ++name; | 160 ++name; |
161 } | 161 } |
162 return true; | 162 return true; |
163 } | 163 } |
164 | 164 |
165 } // namespcae predictor | 165 } // namespcae predictor |
OLD | NEW |