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

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

Issue 732633002: Adding instrumentation to locate the source of jankiness. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke@ comments Created 6 years, 1 month 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
« no previous file with comments | « net/ocsp/nss_ocsp.cc ('k') | net/url_request/sdch_dictionary_fetcher.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) 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_script_fetcher_impl.h" 5 #include "net/proxy/proxy_script_fetcher_impl.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/profiler/scoped_tracker.h"
10 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
11 #include "net/base/data_url.h" 12 #include "net/base/data_url.h"
12 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
13 #include "net/base/load_flags.h" 14 #include "net/base/load_flags.h"
14 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
15 #include "net/base/net_string_util.h" 16 #include "net/base/net_string_util.h"
16 #include "net/base/request_priority.h" 17 #include "net/base/request_priority.h"
17 #include "net/cert/cert_status_flags.h" 18 #include "net/cert/cert_status_flags.h"
18 #include "net/http/http_response_headers.h" 19 #include "net/http/http_response_headers.h"
19 #include "net/url_request/url_request_context.h" 20 #include "net/url_request/url_request_context.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 request->ContinueDespiteLastError(); 196 request->ContinueDespiteLastError();
196 return; 197 return;
197 } 198 }
198 LOG(WARNING) << "SSL certificate error when fetching PAC script, aborting."; 199 LOG(WARNING) << "SSL certificate error when fetching PAC script, aborting.";
199 // Certificate errors are in same space as net errors. 200 // Certificate errors are in same space as net errors.
200 result_code_ = MapCertStatusToNetError(ssl_info.cert_status); 201 result_code_ = MapCertStatusToNetError(ssl_info.cert_status);
201 request->Cancel(); 202 request->Cancel();
202 } 203 }
203 204
204 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) { 205 void ProxyScriptFetcherImpl::OnResponseStarted(URLRequest* request) {
206 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
207 tracked_objects::ScopedTracker tracking_profile(
208 FROM_HERE_WITH_EXPLICIT_FUNCTION(
209 "423948 ProxyScriptFetcherImpl::OnResponseStarted"));
210
205 DCHECK_EQ(request, cur_request_.get()); 211 DCHECK_EQ(request, cur_request_.get());
206 212
207 if (!request->status().is_success()) { 213 if (!request->status().is_success()) {
208 OnResponseCompleted(request); 214 OnResponseCompleted(request);
209 return; 215 return;
210 } 216 }
211 217
212 // Require HTTP responses to have a success status code. 218 // Require HTTP responses to have a success status code.
213 if (request->url().SchemeIsHTTPOrHTTPS()) { 219 if (request->url().SchemeIsHTTPOrHTTPS()) {
214 // NOTE about status codes: We are like Firefox 3 in this respect. 220 // NOTE about status codes: We are like Firefox 3 in this respect.
(...skipping 15 matching lines...) Expand all
230 VLOG(1) << "Fetched PAC script does not have a proper mime type: " 236 VLOG(1) << "Fetched PAC script does not have a proper mime type: "
231 << mime_type; 237 << mime_type;
232 } 238 }
233 } 239 }
234 240
235 ReadBody(request); 241 ReadBody(request);
236 } 242 }
237 243
238 void ProxyScriptFetcherImpl::OnReadCompleted(URLRequest* request, 244 void ProxyScriptFetcherImpl::OnReadCompleted(URLRequest* request,
239 int num_bytes) { 245 int num_bytes) {
246 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
247 tracked_objects::ScopedTracker tracking_profile(
248 FROM_HERE_WITH_EXPLICIT_FUNCTION(
249 "423948 ProxyScriptFetcherImpl::OnReadCompleted"));
250
240 DCHECK_EQ(request, cur_request_.get()); 251 DCHECK_EQ(request, cur_request_.get());
241 if (ConsumeBytesRead(request, num_bytes)) { 252 if (ConsumeBytesRead(request, num_bytes)) {
242 // Keep reading. 253 // Keep reading.
243 ReadBody(request); 254 ReadBody(request);
244 } 255 }
245 } 256 }
246 257
247 void ProxyScriptFetcherImpl::ReadBody(URLRequest* request) { 258 void ProxyScriptFetcherImpl::ReadBody(URLRequest* request) {
248 // Read as many bytes as are available synchronously. 259 // Read as many bytes as are available synchronously.
249 while (true) { 260 while (true) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // is still applicable. 322 // is still applicable.
312 if (cur_request_id_ != id) 323 if (cur_request_id_ != id)
313 return; 324 return;
314 325
315 DCHECK(cur_request_.get()); 326 DCHECK(cur_request_.get());
316 result_code_ = ERR_TIMED_OUT; 327 result_code_ = ERR_TIMED_OUT;
317 cur_request_->Cancel(); 328 cur_request_->Cancel();
318 } 329 }
319 330
320 } // namespace net 331 } // namespace net
OLDNEW
« no previous file with comments | « net/ocsp/nss_ocsp.cc ('k') | net/url_request/sdch_dictionary_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698