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

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

Issue 2213683003: Update Effective Connection Type only on main frame requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: PS Created 4 years, 4 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 response->head.was_fetched_via_proxy = request->was_fetched_via_proxy(); 83 response->head.was_fetched_via_proxy = request->was_fetched_via_proxy();
84 response->head.proxy_server = response_info.proxy_server; 84 response->head.proxy_server = response_info.proxy_server;
85 response->head.socket_address = response_info.socket_address; 85 response->head.socket_address = response_info.socket_address;
86 const content::ResourceRequestInfo* request_info = 86 const content::ResourceRequestInfo* request_info =
87 content::ResourceRequestInfo::ForRequest(request); 87 content::ResourceRequestInfo::ForRequest(request);
88 if (request_info) 88 if (request_info)
89 response->head.is_using_lofi = request_info->IsUsingLoFi(); 89 response->head.is_using_lofi = request_info->IsUsingLoFi();
90 90
91 response->head.effective_connection_type = 91 response->head.effective_connection_type =
92 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; 92 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
93 if (info->IsMainFrame()) { 93
94 if (info->IsMainFrame() &&
RyanSturm 2016/08/08 18:13:37 Is the info->IsMainFrame() part of this necessary?
tbansal1 2016/08/08 18:35:25 Done.
95 (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME)) {
RyanSturm 2016/08/08 18:13:37 #include "content/public/common/resource_type.h"
tbansal1 2016/08/08 18:35:25 Done.
94 net::NetworkQualityEstimator* estimator = 96 net::NetworkQualityEstimator* estimator =
95 request->context()->network_quality_estimator(); 97 request->context()->network_quality_estimator();
96 if (estimator) { 98 if (estimator) {
97 response->head.effective_connection_type = 99 response->head.effective_connection_type =
98 estimator->GetEffectiveConnectionType(); 100 estimator->GetEffectiveConnectionType();
99 } 101 }
100 } 102 }
101 103
102 const ServiceWorkerResponseInfo* service_worker_info = 104 const ServiceWorkerResponseInfo* service_worker_info =
103 ServiceWorkerResponseInfo::ForRequest(request); 105 ServiceWorkerResponseInfo::ForRequest(request);
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 } 738 }
737 739
738 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 740 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
739 } else if (request_->response_info().unused_since_prefetch) { 741 } else if (request_->response_info().unused_since_prefetch) {
740 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); 742 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time();
741 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); 743 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time);
742 } 744 }
743 } 745 }
744 746
745 } // namespace content 747 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/loader/resource_loader_unittest.cc » ('j') | content/browser/loader/resource_loader_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698