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

Side by Side Diff: net/url_request/url_fetcher_core.cc

Issue 1073033002: Modify instrumentation for various jank bugs, mostly removing outdated sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/url_request/url_request.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"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 if (!response_writer_) 546 if (!response_writer_)
547 response_writer_.reset(new URLFetcherStringWriter); 547 response_writer_.reset(new URLFetcherStringWriter);
548 548
549 const int result = response_writer_->Initialize( 549 const int result = response_writer_->Initialize(
550 base::Bind(&URLFetcherCore::DidInitializeWriter, this)); 550 base::Bind(&URLFetcherCore::DidInitializeWriter, this));
551 if (result != ERR_IO_PENDING) 551 if (result != ERR_IO_PENDING)
552 DidInitializeWriter(result); 552 DidInitializeWriter(result);
553 } 553 }
554 554
555 void URLFetcherCore::StartURLRequest() { 555 void URLFetcherCore::StartURLRequest() {
556 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed.
557 tracked_objects::ScopedTracker tracking_profile1(
558 FROM_HERE_WITH_EXPLICIT_FUNCTION(
559 "456327 URLFetcherCore::StartURLRequest1"));
560 DCHECK(network_task_runner_->BelongsToCurrentThread()); 556 DCHECK(network_task_runner_->BelongsToCurrentThread());
561 557
562 if (was_cancelled_) { 558 if (was_cancelled_) {
563 // Since StartURLRequest() is posted as a *delayed* task, it may 559 // Since StartURLRequest() is posted as a *delayed* task, it may
564 // run after the URLFetcher was already stopped. 560 // run after the URLFetcher was already stopped.
565 return; 561 return;
566 } 562 }
567 563
568 DCHECK(request_context_getter_.get()); 564 DCHECK(request_context_getter_.get());
569 DCHECK(!request_.get()); 565 DCHECK(!request_.get());
570 566
571 g_registry.Get().AddURLFetcherCore(this); 567 g_registry.Get().AddURLFetcherCore(this);
572 current_response_bytes_ = 0; 568 current_response_bytes_ = 0;
573 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest( 569 request_ = request_context_getter_->GetURLRequestContext()->CreateRequest(
574 original_url_, DEFAULT_PRIORITY, this); 570 original_url_, DEFAULT_PRIORITY, this);
575 request_->set_stack_trace(stack_trace_); 571 request_->set_stack_trace(stack_trace_);
576 int flags = request_->load_flags() | load_flags_; 572 int flags = request_->load_flags() | load_flags_;
577 573
578 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed.
579 tracked_objects::ScopedTracker tracking_profile2(
580 FROM_HERE_WITH_EXPLICIT_FUNCTION(
581 "456327 URLFetcherCore::StartURLRequest2"));
582 if (is_chunked_upload_) 574 if (is_chunked_upload_)
583 request_->EnableChunkedUpload(); 575 request_->EnableChunkedUpload();
584 request_->SetLoadFlags(flags); 576 request_->SetLoadFlags(flags);
585 request_->SetReferrer(referrer_); 577 request_->SetReferrer(referrer_);
586 request_->set_referrer_policy(referrer_policy_); 578 request_->set_referrer_policy(referrer_policy_);
587 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ? 579 request_->set_first_party_for_cookies(first_party_for_cookies_.is_empty() ?
588 original_url_ : first_party_for_cookies_); 580 original_url_ : first_party_for_cookies_);
589 if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) { 581 if (url_request_data_key_ && !url_request_create_data_callback_.is_null()) {
590 request_->SetUserData(url_request_data_key_, 582 request_->SetUserData(url_request_data_key_,
591 url_request_create_data_callback_.Run()); 583 url_request_create_data_callback_.Run());
592 } 584 }
593 585
594 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed.
595 tracked_objects::ScopedTracker tracking_profile3(
596 FROM_HERE_WITH_EXPLICIT_FUNCTION(
597 "456327 URLFetcherCore::StartURLRequest3"));
598 switch (request_type_) { 586 switch (request_type_) {
599 case URLFetcher::GET: 587 case URLFetcher::GET:
600 break; 588 break;
601 589
602 case URLFetcher::POST: 590 case URLFetcher::POST:
603 case URLFetcher::PUT: 591 case URLFetcher::PUT:
604 case URLFetcher::PATCH: { 592 case URLFetcher::PATCH: {
605 // Upload content must be set. 593 // Upload content must be set.
606 DCHECK(is_chunked_upload_ || upload_content_set_); 594 DCHECK(is_chunked_upload_ || upload_content_set_);
607 595
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 break; 638 break;
651 639
652 case URLFetcher::DELETE_REQUEST: 640 case URLFetcher::DELETE_REQUEST:
653 request_->set_method("DELETE"); 641 request_->set_method("DELETE");
654 break; 642 break;
655 643
656 default: 644 default:
657 NOTREACHED(); 645 NOTREACHED();
658 } 646 }
659 647
660 // TODO(pkasting): Remove ScopedTracker below once crbug.com/456327 is fixed.
661 tracked_objects::ScopedTracker tracking_profile4(
662 FROM_HERE_WITH_EXPLICIT_FUNCTION(
663 "456327 URLFetcherCore::StartURLRequest4"));
664 if (!extra_request_headers_.IsEmpty()) 648 if (!extra_request_headers_.IsEmpty())
665 request_->SetExtraRequestHeaders(extra_request_headers_); 649 request_->SetExtraRequestHeaders(extra_request_headers_);
666 650
667 request_->Start(); 651 request_->Start();
668 } 652 }
669 653
670 void URLFetcherCore::DidInitializeWriter(int result) { 654 void URLFetcherCore::DidInitializeWriter(int result) {
671 if (result != OK) { 655 if (result != OK) {
672 CancelURLRequest(result); 656 CancelURLRequest(result);
673 delegate_task_runner_->PostTask( 657 delegate_task_runner_->PostTask(
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 } 972 }
989 973
990 void URLFetcherCore::AssertHasNoUploadData() const { 974 void URLFetcherCore::AssertHasNoUploadData() const {
991 DCHECK(!upload_content_set_); 975 DCHECK(!upload_content_set_);
992 DCHECK(upload_content_.empty()); 976 DCHECK(upload_content_.empty());
993 DCHECK(upload_file_path_.empty()); 977 DCHECK(upload_file_path_.empty());
994 DCHECK(upload_stream_factory_.is_null()); 978 DCHECK(upload_stream_factory_.is_null());
995 } 979 }
996 980
997 } // namespace net 981 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_service.cc ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698