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

Side by Side Diff: net/url_request/url_fetcher_core.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/url_request/sdch_dictionary_fetcher.cc ('k') | net/websockets/websocket_stream.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/url_request/url_fetcher_core.h" 5 #include "net/url_request/url_fetcher_core.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/profiler/scoped_tracker.h"
12 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "base/stl_util.h" 15 #include "base/stl_util.h"
15 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
16 #include "base/tracked_objects.h" 17 #include "base/tracked_objects.h"
17 #include "net/base/elements_upload_data_stream.h" 18 #include "net/base/elements_upload_data_stream.h"
18 #include "net/base/io_buffer.h" 19 #include "net/base/io_buffer.h"
19 #include "net/base/load_flags.h" 20 #include "net/base/load_flags.h"
20 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
21 #include "net/base/request_priority.h" 22 #include "net/base/request_priority.h"
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 stopped_on_redirect_ = true; 384 stopped_on_redirect_ = true;
384 url_ = redirect_info.new_url; 385 url_ = redirect_info.new_url;
385 response_code_ = request_->GetResponseCode(); 386 response_code_ = request_->GetResponseCode();
386 was_fetched_via_proxy_ = request_->was_fetched_via_proxy(); 387 was_fetched_via_proxy_ = request_->was_fetched_via_proxy();
387 request->Cancel(); 388 request->Cancel();
388 OnReadCompleted(request, 0); 389 OnReadCompleted(request, 0);
389 } 390 }
390 } 391 }
391 392
392 void URLFetcherCore::OnResponseStarted(URLRequest* request) { 393 void URLFetcherCore::OnResponseStarted(URLRequest* request) {
394 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
395 tracked_objects::ScopedTracker tracking_profile(
396 FROM_HERE_WITH_EXPLICIT_FUNCTION(
397 "423948 URLFetcherCore::OnResponseStarted"));
398
393 DCHECK_EQ(request, request_.get()); 399 DCHECK_EQ(request, request_.get());
394 DCHECK(network_task_runner_->BelongsToCurrentThread()); 400 DCHECK(network_task_runner_->BelongsToCurrentThread());
395 if (request_->status().is_success()) { 401 if (request_->status().is_success()) {
396 response_code_ = request_->GetResponseCode(); 402 response_code_ = request_->GetResponseCode();
397 response_headers_ = request_->response_headers(); 403 response_headers_ = request_->response_headers();
398 socket_address_ = request_->GetSocketAddress(); 404 socket_address_ = request_->GetSocketAddress();
399 was_fetched_via_proxy_ = request_->was_fetched_via_proxy(); 405 was_fetched_via_proxy_ = request_->was_fetched_via_proxy();
400 total_response_bytes_ = request_->GetExpectedContentSize(); 406 total_response_bytes_ = request_->GetExpectedContentSize();
401 } 407 }
402 408
403 ReadResponse(); 409 ReadResponse();
404 } 410 }
405 411
406 void URLFetcherCore::OnCertificateRequested( 412 void URLFetcherCore::OnCertificateRequested(
407 URLRequest* request, 413 URLRequest* request,
408 SSLCertRequestInfo* cert_request_info) { 414 SSLCertRequestInfo* cert_request_info) {
409 DCHECK_EQ(request, request_.get()); 415 DCHECK_EQ(request, request_.get());
410 DCHECK(network_task_runner_->BelongsToCurrentThread()); 416 DCHECK(network_task_runner_->BelongsToCurrentThread());
411 417
412 if (g_ignore_certificate_requests) { 418 if (g_ignore_certificate_requests) {
413 request->ContinueWithCertificate(NULL); 419 request->ContinueWithCertificate(NULL);
414 } else { 420 } else {
415 request->Cancel(); 421 request->Cancel();
416 } 422 }
417 } 423 }
418 424
419 void URLFetcherCore::OnReadCompleted(URLRequest* request, 425 void URLFetcherCore::OnReadCompleted(URLRequest* request,
420 int bytes_read) { 426 int bytes_read) {
427 // TODO(vadimt): Remove ScopedTracker below once crbug.com/423948 is fixed.
428 tracked_objects::ScopedTracker tracking_profile(
429 FROM_HERE_WITH_EXPLICIT_FUNCTION(
430 "423948 URLFetcherCore::OnReadCompleted"));
431
421 DCHECK(request == request_); 432 DCHECK(request == request_);
422 DCHECK(network_task_runner_->BelongsToCurrentThread()); 433 DCHECK(network_task_runner_->BelongsToCurrentThread());
423 434
424 if (!stopped_on_redirect_) 435 if (!stopped_on_redirect_)
425 url_ = request->url(); 436 url_ = request->url();
426 URLRequestThrottlerManager* throttler_manager = 437 URLRequestThrottlerManager* throttler_manager =
427 request->context()->throttler_manager(); 438 request->context()->throttler_manager();
428 if (throttler_manager) { 439 if (throttler_manager) {
429 url_throttler_entry_ = throttler_manager->RegisterRequestUrl(url_); 440 url_throttler_entry_ = throttler_manager->RegisterRequestUrl(url_);
430 } 441 }
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 } 906 }
896 907
897 void URLFetcherCore::InformDelegateDownloadProgressInDelegateThread( 908 void URLFetcherCore::InformDelegateDownloadProgressInDelegateThread(
898 int64 current, int64 total) { 909 int64 current, int64 total) {
899 DCHECK(delegate_task_runner_->BelongsToCurrentThread()); 910 DCHECK(delegate_task_runner_->BelongsToCurrentThread());
900 if (delegate_) 911 if (delegate_)
901 delegate_->OnURLFetchDownloadProgress(fetcher_, current, total); 912 delegate_->OnURLFetchDownloadProgress(fetcher_, current, total);
902 } 913 }
903 914
904 } // namespace net 915 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/sdch_dictionary_fetcher.cc ('k') | net/websockets/websocket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698