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

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

Issue 1921613003: Count successes of link rel=prefetch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 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
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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 if (request_->response_info().network_accessed) { 712 if (request_->response_info().network_accessed) {
713 UMA_HISTOGRAM_ENUMERATION("Net.HttpResponseInfo.ConnectionInfo", 713 UMA_HISTOGRAM_ENUMERATION("Net.HttpResponseInfo.ConnectionInfo",
714 request_->response_info().connection_info, 714 request_->response_info().connection_info,
715 net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS); 715 net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS);
716 } 716 }
717 717
718 ResourceRequestInfoImpl* info = GetRequestInfo(); 718 ResourceRequestInfoImpl* info = GetRequestInfo();
719 719
720 if (info->GetResourceType() == RESOURCE_TYPE_PREFETCH) { 720 if (info->GetResourceType() == RESOURCE_TYPE_PREFETCH) {
721 PrefetchStatus status = STATUS_UNDEFINED; 721 PrefetchStatus status = STATUS_UNDEFINED;
722 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); 722 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
gavinp 2016/04/25 15:39:05 Since this is defined on both sides of the if(), s
jkarlin 2016/04/25 15:46:14 Either case is likely to be rare (if prefetch or u
gavinp 2016/04/25 15:47:47 Oh, you're right. I hadn't paid enough attention t
723 723
724 switch (request_->status().status()) { 724 switch (request_->status().status()) {
725 case net::URLRequestStatus::SUCCESS: 725 case net::URLRequestStatus::SUCCESS:
726 if (request_->was_cached()) { 726 if (request_->was_cached()) {
727 status = STATUS_SUCCESS_FROM_CACHE; 727 status = STATUS_SUCCESS_FROM_CACHE;
728 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentPrefetchingFromCache", 728 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentPrefetchingFromCache",
729 total_time); 729 total_time);
730 } else { 730 } else {
731 status = STATUS_SUCCESS_FROM_NETWORK; 731 status = STATUS_SUCCESS_FROM_NETWORK;
732 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentPrefetchingFromNetwork", 732 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentPrefetchingFromNetwork",
733 total_time); 733 total_time);
734 } 734 }
735 break; 735 break;
736 case net::URLRequestStatus::CANCELED: 736 case net::URLRequestStatus::CANCELED:
737 status = STATUS_CANCELED; 737 status = STATUS_CANCELED;
738 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeBeforeCancel", total_time); 738 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeBeforeCancel", total_time);
739 break; 739 break;
740 case net::URLRequestStatus::IO_PENDING: 740 case net::URLRequestStatus::IO_PENDING:
741 case net::URLRequestStatus::FAILED: 741 case net::URLRequestStatus::FAILED:
742 status = STATUS_UNDEFINED; 742 status = STATUS_UNDEFINED;
743 break; 743 break;
744 } 744 }
745 745
746 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 746 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
747 } else if (request_->response_info().unused_since_prefetch) {
748 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
749 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time);
747 } 750 }
748 } 751 }
749 752
750 } // namespace content 753 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | net/url_request/url_request_http_job.cc » ('j') | net/url_request/url_request_http_job.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698