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

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

Issue 2119623002: Add metrics to track HTTP/0.9 usage for main frames and subresources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to comments Created 4 years, 5 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 } 702 }
703 } 703 }
704 704
705 void ResourceLoader::CallDidFinishLoading() { 705 void ResourceLoader::CallDidFinishLoading() {
706 TRACE_EVENT_WITH_FLOW0("loading", "ResourceLoader::CallDidFinishLoading", 706 TRACE_EVENT_WITH_FLOW0("loading", "ResourceLoader::CallDidFinishLoading",
707 this, TRACE_EVENT_FLAG_FLOW_IN); 707 this, TRACE_EVENT_FLAG_FLOW_IN);
708 delegate_->DidFinishLoading(this); 708 delegate_->DidFinishLoading(this);
709 } 709 }
710 710
711 void ResourceLoader::RecordHistograms() { 711 void ResourceLoader::RecordHistograms() {
712 ResourceRequestInfoImpl* info = GetRequestInfo();
712 if (request_->response_info().network_accessed) { 713 if (request_->response_info().network_accessed) {
713 UMA_HISTOGRAM_ENUMERATION("Net.HttpResponseInfo.ConnectionInfo", 714 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) {
714 request_->response_info().connection_info, 715 UMA_HISTOGRAM_ENUMERATION("Net.HttpResponseInfo.ConnectionInfo.MainFrame",
715 net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS); 716 request_->response_info().connection_info,
717 net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS);
718 } else {
719 UMA_HISTOGRAM_ENUMERATION(
720 "Net.HttpResponseInfo.ConnectionInfo.SubResource",
721 request_->response_info().connection_info,
722 net::HttpResponseInfo::NUM_OF_CONNECTION_INFOS);
723 }
716 } 724 }
717 725
718 ResourceRequestInfoImpl* info = GetRequestInfo();
719
720 if (info->GetResourceType() == RESOURCE_TYPE_PREFETCH) { 726 if (info->GetResourceType() == RESOURCE_TYPE_PREFETCH) {
721 PrefetchStatus status = STATUS_UNDEFINED; 727 PrefetchStatus status = STATUS_UNDEFINED;
722 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); 728 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
723 729
724 switch (request_->status().status()) { 730 switch (request_->status().status()) {
725 case net::URLRequestStatus::SUCCESS: 731 case net::URLRequestStatus::SUCCESS:
726 if (request_->was_cached()) { 732 if (request_->was_cached()) {
727 status = STATUS_SUCCESS_FROM_CACHE; 733 status = STATUS_SUCCESS_FROM_CACHE;
728 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentPrefetchingFromCache", 734 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentPrefetchingFromCache",
729 total_time); 735 total_time);
(...skipping 14 matching lines...) Expand all
744 } 750 }
745 751
746 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 752 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
747 } else if (request_->response_info().unused_since_prefetch) { 753 } else if (request_->response_info().unused_since_prefetch) {
748 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); 754 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
749 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); 755 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time);
750 } 756 }
751 } 757 }
752 758
753 } // namespace content 759 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698