Chromium Code Reviews| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 633 } | 633 } |
| 634 | 634 |
| 635 // Each function handles resolution errors differently. | 635 // Each function handles resolution errors differently. |
| 636 switch (op) { | 636 switch (op) { |
| 637 case JSBindings::DNS_RESOLVE: | 637 case JSBindings::DNS_RESOLVE: |
| 638 args.GetReturnValue().SetNull(); | 638 args.GetReturnValue().SetNull(); |
| 639 return; | 639 return; |
| 640 case JSBindings::DNS_RESOLVE_EX: | 640 case JSBindings::DNS_RESOLVE_EX: |
| 641 args.GetReturnValue().SetEmptyString(); | 641 args.GetReturnValue().SetEmptyString(); |
| 642 return; | 642 return; |
| 643 case JSBindings::MY_IP_ADDRESS: | 643 case JSBindings::MY_IP_ADDRESS: { |
| 644 args.GetReturnValue().Set( | 644 std::string default_ip_address = |
| 645 ASCIILiteralToV8String(args.GetIsolate(), "127.0.0.1")); | 645 context->parent_->default_my_ip_address(); |
| 646 if (default_ip_address.empty()) | |
| 647 default_ip_address = "127.0.0.1"; | |
| 648 args.GetReturnValue().Set(ASCIILiteralToV8String( | |
|
eroman
2014/04/16 02:12:52
This is not correct. Note that this is the error h
| |
| 649 args.GetIsolate(), default_ip_address.c_str())); | |
| 646 return; | 650 return; |
| 651 } | |
| 647 case JSBindings::MY_IP_ADDRESS_EX: | 652 case JSBindings::MY_IP_ADDRESS_EX: |
| 648 args.GetReturnValue().SetEmptyString(); | 653 args.GetReturnValue().SetEmptyString(); |
| 649 return; | 654 return; |
| 650 } | 655 } |
| 651 | 656 |
| 652 NOTREACHED(); | 657 NOTREACHED(); |
| 653 } | 658 } |
| 654 | 659 |
| 655 // V8 callback for when "sortIpAddressList()" is invoked by the PAC script. | 660 // V8 callback for when "sortIpAddressList()" is invoked by the PAC script. |
| 656 static void SortIpAddressListCallback( | 661 static void SortIpAddressListCallback( |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 return 0; | 806 return 0; |
| 802 | 807 |
| 803 v8::Locker locked(g_proxy_resolver_isolate_->isolate()); | 808 v8::Locker locked(g_proxy_resolver_isolate_->isolate()); |
| 804 v8::Isolate::Scope isolate_scope(g_proxy_resolver_isolate_->isolate()); | 809 v8::Isolate::Scope isolate_scope(g_proxy_resolver_isolate_->isolate()); |
| 805 v8::HeapStatistics heap_statistics; | 810 v8::HeapStatistics heap_statistics; |
| 806 g_proxy_resolver_isolate_->isolate()->GetHeapStatistics(&heap_statistics); | 811 g_proxy_resolver_isolate_->isolate()->GetHeapStatistics(&heap_statistics); |
| 807 return heap_statistics.used_heap_size(); | 812 return heap_statistics.used_heap_size(); |
| 808 } | 813 } |
| 809 | 814 |
| 810 } // namespace net | 815 } // namespace net |
| OLD | NEW |