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

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

Issue 2817043: Reduce the copying of string data between C++ and javascript in proxy_resolver_v8.cc. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix comment typo 'converts' Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/init_proxy_resolver.h ('k') | net/proxy/init_proxy_resolver_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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/init_proxy_resolver.h" 5 #include "net/proxy/init_proxy_resolver.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 127
128 net_log_.BeginEvent( 128 net_log_.BeginEvent(
129 NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, 129 NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
130 new NetLogStringParameter("url", pac_url.spec())); 130 new NetLogStringParameter("url", pac_url.spec()));
131 131
132 if (!proxy_script_fetcher_) { 132 if (!proxy_script_fetcher_) {
133 net_log_.AddEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_HAS_NO_FETCHER, NULL); 133 net_log_.AddEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_HAS_NO_FETCHER, NULL);
134 return ERR_UNEXPECTED; 134 return ERR_UNEXPECTED;
135 } 135 }
136 136
137 return proxy_script_fetcher_->Fetch(pac_url, &pac_bytes_, &io_callback_); 137 return proxy_script_fetcher_->Fetch(pac_url, &pac_script_, &io_callback_);
138 } 138 }
139 139
140 int InitProxyResolver::DoFetchPacScriptComplete(int result) { 140 int InitProxyResolver::DoFetchPacScriptComplete(int result) {
141 DCHECK(resolver_->expects_pac_bytes()); 141 DCHECK(resolver_->expects_pac_bytes());
142 142
143 if (result == OK) { 143 if (result == OK) {
144 net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, NULL); 144 net_log_.EndEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, NULL);
145 } else { 145 } else {
146 net_log_.EndEvent( 146 net_log_.EndEvent(
147 NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT, 147 NetLog::TYPE_INIT_PROXY_RESOLVER_FETCH_PAC_SCRIPT,
148 new NetLogIntegerParameter("net_error", result)); 148 new NetLogIntegerParameter("net_error", result));
149 return TryToFallbackPacUrl(result); 149 return TryToFallbackPacUrl(result);
150 } 150 }
151 151
152 next_state_ = STATE_SET_PAC_SCRIPT; 152 next_state_ = STATE_SET_PAC_SCRIPT;
153 return result; 153 return result;
154 } 154 }
155 155
156 int InitProxyResolver::DoSetPacScript() { 156 int InitProxyResolver::DoSetPacScript() {
157 net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, NULL); 157 net_log_.BeginEvent(NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, NULL);
158 158
159 const GURL& pac_url = current_pac_url(); 159 const GURL& pac_url = current_pac_url();
160 160
161 next_state_ = STATE_SET_PAC_SCRIPT_COMPLETE; 161 next_state_ = STATE_SET_PAC_SCRIPT_COMPLETE;
162 162
163 return resolver_->expects_pac_bytes() ? 163 return resolver_->expects_pac_bytes() ?
164 resolver_->SetPacScriptByData(pac_bytes_, &io_callback_) : 164 resolver_->SetPacScriptByData(pac_script_, &io_callback_) :
165 resolver_->SetPacScriptByUrl(pac_url, &io_callback_); 165 resolver_->SetPacScriptByUrl(pac_url, &io_callback_);
166 } 166 }
167 167
168 int InitProxyResolver::DoSetPacScriptComplete(int result) { 168 int InitProxyResolver::DoSetPacScriptComplete(int result) {
169 if (result != OK) { 169 if (result != OK) {
170 net_log_.EndEvent( 170 net_log_.EndEvent(
171 NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT, 171 NetLog::TYPE_INIT_PROXY_RESOLVER_SET_PAC_SCRIPT,
172 new NetLogIntegerParameter("net_error", result)); 172 new NetLogIntegerParameter("net_error", result));
173 return TryToFallbackPacUrl(result); 173 return TryToFallbackPacUrl(result);
174 } 174 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 break; 224 break;
225 default: 225 default:
226 NOTREACHED(); 226 NOTREACHED();
227 break; 227 break;
228 } 228 }
229 229
230 DidCompleteInit(); 230 DidCompleteInit();
231 } 231 }
232 232
233 } // namespace net 233 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/init_proxy_resolver.h ('k') | net/proxy/init_proxy_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698