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

Side by Side Diff: net/proxy/proxy_resolver_v8.cc

Issue 8985012: base::Bind: Convert net/proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more include. Created 9 years 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 | « net/proxy/proxy_resolver_v8.h ('k') | net/proxy/proxy_resolver_v8_unittest.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 #include <algorithm> 5 #include <algorithm>
6 #include <cstdio> 6 #include <cstdio>
7 7
8 #include "net/proxy/proxy_resolver_v8.h" 8 #include "net/proxy/proxy_resolver_v8.h"
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // ProxyResolverV8 ------------------------------------------------------------ 721 // ProxyResolverV8 ------------------------------------------------------------
722 722
723 ProxyResolverV8::ProxyResolverV8( 723 ProxyResolverV8::ProxyResolverV8(
724 ProxyResolverJSBindings* custom_js_bindings) 724 ProxyResolverJSBindings* custom_js_bindings)
725 : ProxyResolver(true /*expects_pac_bytes*/), 725 : ProxyResolver(true /*expects_pac_bytes*/),
726 js_bindings_(custom_js_bindings) { 726 js_bindings_(custom_js_bindings) {
727 } 727 }
728 728
729 ProxyResolverV8::~ProxyResolverV8() {} 729 ProxyResolverV8::~ProxyResolverV8() {}
730 730
731 int ProxyResolverV8::GetProxyForURL(const GURL& query_url, 731 int ProxyResolverV8::GetProxyForURL(
732 ProxyInfo* results, 732 const GURL& query_url, ProxyInfo* results,
733 OldCompletionCallback* /*callback*/, 733 const CompletionCallback& /*callback*/,
734 RequestHandle* /*request*/, 734 RequestHandle* /*request*/,
735 const BoundNetLog& net_log) { 735 const BoundNetLog& net_log) {
736 // If the V8 instance has not been initialized (either because 736 // If the V8 instance has not been initialized (either because
737 // SetPacScript() wasn't called yet, or because it failed. 737 // SetPacScript() wasn't called yet, or because it failed.
738 if (!context_.get()) 738 if (!context_.get())
739 return ERR_FAILED; 739 return ERR_FAILED;
740 740
741 // Associate some short-lived context with this request. This context will be 741 // Associate some short-lived context with this request. This context will be
742 // available to any of the javascript "bindings" that are subsequently invoked 742 // available to any of the javascript "bindings" that are subsequently invoked
743 // from the javascript. 743 // from the javascript.
744 // 744 //
745 // In particular, we create a HostCache that is aggressive about caching 745 // In particular, we create a HostCache that is aggressive about caching
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
782 void ProxyResolverV8::PurgeMemory() { 782 void ProxyResolverV8::PurgeMemory() {
783 context_->PurgeMemory(); 783 context_->PurgeMemory();
784 } 784 }
785 785
786 void ProxyResolverV8::Shutdown() { 786 void ProxyResolverV8::Shutdown() {
787 js_bindings_->Shutdown(); 787 js_bindings_->Shutdown();
788 } 788 }
789 789
790 int ProxyResolverV8::SetPacScript( 790 int ProxyResolverV8::SetPacScript(
791 const scoped_refptr<ProxyResolverScriptData>& script_data, 791 const scoped_refptr<ProxyResolverScriptData>& script_data,
792 OldCompletionCallback* /*callback*/) { 792 const CompletionCallback& /*callback*/) {
793 DCHECK(script_data.get()); 793 DCHECK(script_data.get());
794 context_.reset(); 794 context_.reset();
795 if (script_data->utf16().empty()) 795 if (script_data->utf16().empty())
796 return ERR_PAC_SCRIPT_FAILED; 796 return ERR_PAC_SCRIPT_FAILED;
797 797
798 // Try parsing the PAC script. 798 // Try parsing the PAC script.
799 scoped_ptr<Context> context(new Context(js_bindings_.get())); 799 scoped_ptr<Context> context(new Context(js_bindings_.get()));
800 int rv = context->InitV8(script_data); 800 int rv = context->InitV8(script_data);
801 if (rv == OK) 801 if (rv == OK)
802 context_.reset(context.release()); 802 context_.reset(context.release());
803 return rv; 803 return rv;
804 } 804 }
805 805
806 } // namespace net 806 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_resolver_v8.h ('k') | net/proxy/proxy_resolver_v8_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698