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

Side by Side Diff: content/browser/loader/resource_loader.cc

Issue 2669243006: Remove ResourceLoader PostTask after reading headers. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | no next file » | 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 "content/browser/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 scoped_refptr<ResourceResponse> response = new ResourceResponse(); 635 scoped_refptr<ResourceResponse> response = new ResourceResponse();
636 PopulateResourceResponse(info, request_.get(), response.get()); 636 PopulateResourceResponse(info, request_.get(), response.get());
637 637
638 delegate_->DidReceiveResponse(this); 638 delegate_->DidReceiveResponse(this);
639 639
640 // TODO(darin): Remove ScopedTracker below once crbug.com/475761 is fixed. 640 // TODO(darin): Remove ScopedTracker below once crbug.com/475761 is fixed.
641 tracked_objects::ScopedTracker tracking_profile( 641 tracked_objects::ScopedTracker tracking_profile(
642 FROM_HERE_WITH_EXPLICIT_FUNCTION("475761 OnResponseStarted()")); 642 FROM_HERE_WITH_EXPLICIT_FUNCTION("475761 OnResponseStarted()"));
643 643
644 read_deferral_start_time_ = base::TimeTicks::Now(); 644 read_deferral_start_time_ = base::TimeTicks::Now();
645 ScopedDeferral scoped_deferral(this, DEFERRED_READ); 645 deferred_stage_ = DEFERRED_SYNC;
Charlie Harrison 2017/02/02 21:37:38 Please comment when we can't use scoped deferral.
mmenke 2017/02/02 21:41:07 You're completely right. Done.
646 handler_->OnResponseStarted(response.get(), 646 handler_->OnResponseStarted(response.get(),
647 base::MakeUnique<Controller>(this)); 647 base::MakeUnique<Controller>(this));
648 if (is_deferred()) {
649 deferred_stage_ = DEFERRED_READ;
650 } else {
651 ReadMore(false);
652 }
648 } 653 }
649 654
650 void ResourceLoader::ReadMore(bool handle_result_async) { 655 void ResourceLoader::ReadMore(bool handle_result_async) {
651 TRACE_EVENT_WITH_FLOW0("loading", "ResourceLoader::ReadMore", this, 656 TRACE_EVENT_WITH_FLOW0("loading", "ResourceLoader::ReadMore", this,
652 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT); 657 TRACE_EVENT_FLAG_FLOW_IN | TRACE_EVENT_FLAG_FLOW_OUT);
653 DCHECK(!is_deferred()); 658 DCHECK(!is_deferred());
654 659
655 // Make sure we track the buffer in at least one place. This ensures it gets 660 // Make sure we track the buffer in at least one place. This ensures it gets
656 // deleted even in the case the request has already finished its job and 661 // deleted even in the case the request has already finished its job and
657 // doesn't use the buffer. 662 // doesn't use the buffer.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, 807 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status,
803 STATUS_MAX); 808 STATUS_MAX);
804 } 809 }
805 } else if (request_->response_info().unused_since_prefetch) { 810 } else if (request_->response_info().unused_since_prefetch) {
806 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); 811 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
807 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); 812 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time);
808 } 813 }
809 } 814 }
810 815
811 } // namespace content 816 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698