| 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 #include "net/proxy/proxy_resolver_v8.h" | 5 #include "net/proxy/proxy_resolver_v8.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdio> | 8 #include <cstdio> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 (address.size() == 16 && prefix.size() == 16)); | 332 (address.size() == 16 && prefix.size() == 16)); |
| 333 | 333 |
| 334 return IPNumberMatchesPrefix(address, prefix, prefix_length_in_bits); | 334 return IPNumberMatchesPrefix(address, prefix, prefix_length_in_bits); |
| 335 } | 335 } |
| 336 | 336 |
| 337 // Consider only single component domains like 'foo' as plain host names. | 337 // Consider only single component domains like 'foo' as plain host names. |
| 338 bool IsPlainHostName(const std::string& hostname_utf8) { | 338 bool IsPlainHostName(const std::string& hostname_utf8) { |
| 339 if (hostname_utf8.find('.') != std::string::npos) | 339 if (hostname_utf8.find('.') != std::string::npos) |
| 340 return false; | 340 return false; |
| 341 | 341 |
| 342 // IPv6 addresses may not contain periods, however are not be considered a | 342 // IPv6 literals might not contain any periods, however are not considered |
| 343 // plain host name. | 343 // plain host names. |
| 344 IPAddressNumber unused; | 344 IPAddressNumber unused; |
| 345 return !ParseIPLiteralToNumber(hostname_utf8, &unused); | 345 return !ParseIPLiteralToNumber(hostname_utf8, &unused); |
| 346 } | 346 } |
| 347 | 347 |
| 348 } // namespace | 348 } // namespace |
| 349 | 349 |
| 350 // ProxyResolverV8::Context --------------------------------------------------- | 350 // ProxyResolverV8::Context --------------------------------------------------- |
| 351 | 351 |
| 352 class ProxyResolverV8::Context { | 352 class ProxyResolverV8::Context { |
| 353 public: | 353 public: |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 return 0; | 833 return 0; |
| 834 | 834 |
| 835 v8::Locker locked(g_proxy_resolver_isolate_->isolate()); | 835 v8::Locker locked(g_proxy_resolver_isolate_->isolate()); |
| 836 v8::Isolate::Scope isolate_scope(g_proxy_resolver_isolate_->isolate()); | 836 v8::Isolate::Scope isolate_scope(g_proxy_resolver_isolate_->isolate()); |
| 837 v8::HeapStatistics heap_statistics; | 837 v8::HeapStatistics heap_statistics; |
| 838 g_proxy_resolver_isolate_->isolate()->GetHeapStatistics(&heap_statistics); | 838 g_proxy_resolver_isolate_->isolate()->GetHeapStatistics(&heap_statistics); |
| 839 return heap_statistics.used_heap_size(); | 839 return heap_statistics.used_heap_size(); |
| 840 } | 840 } |
| 841 | 841 |
| 842 } // namespace net | 842 } // namespace net |
| OLD | NEW |