| OLD | NEW |
| 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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 void ResourceLoader::CompleteResponseStarted() { | 642 void ResourceLoader::CompleteResponseStarted() { |
| 643 ResourceRequestInfoImpl* info = GetRequestInfo(); | 643 ResourceRequestInfoImpl* info = GetRequestInfo(); |
| 644 scoped_refptr<ResourceResponse> response = new ResourceResponse(); | 644 scoped_refptr<ResourceResponse> response = new ResourceResponse(); |
| 645 PopulateResourceResponse(info, request_.get(), response.get()); | 645 PopulateResourceResponse(info, request_.get(), response.get()); |
| 646 | 646 |
| 647 delegate_->DidReceiveResponse(this, response.get()); | 647 delegate_->DidReceiveResponse(this, response.get()); |
| 648 | 648 |
| 649 // For back-forward navigations, record metrics. |
| 650 // TODO(clamy): Remove once we understand the root cause behind the regression |
| 651 // of PLT for b/f navigations in PlzNavigate. |
| 652 if ((info->GetPageTransition() & ui::PAGE_TRANSITION_FORWARD_BACK) && |
| 653 IsResourceTypeFrame(info->GetResourceType()) && |
| 654 !request_->url().SchemeIsBlob()) { |
| 655 UMA_HISTOGRAM_BOOLEAN("Navigation.BackForward.WasCached", |
| 656 request_->was_cached()); |
| 657 } |
| 658 |
| 649 read_deferral_start_time_ = base::TimeTicks::Now(); | 659 read_deferral_start_time_ = base::TimeTicks::Now(); |
| 650 // Using a ScopedDeferral here would result in calling ReadMore(true) on sync | 660 // Using a ScopedDeferral here would result in calling ReadMore(true) on sync |
| 651 // success. Calling PrepareToReadMore(false) here instead allows small | 661 // success. Calling PrepareToReadMore(false) here instead allows small |
| 652 // responses to be handled completely synchronously, if no ResourceHandler | 662 // responses to be handled completely synchronously, if no ResourceHandler |
| 653 // defers handling of the response. | 663 // defers handling of the response. |
| 654 deferred_stage_ = DEFERRED_SYNC; | 664 deferred_stage_ = DEFERRED_SYNC; |
| 655 handler_->OnResponseStarted(response.get(), | 665 handler_->OnResponseStarted(response.get(), |
| 656 base::MakeUnique<Controller>(this)); | 666 base::MakeUnique<Controller>(this)); |
| 657 if (is_deferred()) { | 667 if (is_deferred()) { |
| 658 deferred_stage_ = DEFERRED_READ; | 668 deferred_stage_ = DEFERRED_READ; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, | 817 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, |
| 808 STATUS_MAX); | 818 STATUS_MAX); |
| 809 } | 819 } |
| 810 } else if (request_->response_info().unused_since_prefetch) { | 820 } else if (request_->response_info().unused_since_prefetch) { |
| 811 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 821 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
| 812 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 822 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
| 813 } | 823 } |
| 814 } | 824 } |
| 815 | 825 |
| 816 } // namespace content | 826 } // namespace content |
| OLD | NEW |