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

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

Issue 2930353005: PlzNavigate: Add metrics to understand bf navigations PLT regression (Closed)
Patch Set: Created 3 years, 6 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 return; 265 return;
266 266
267 if (result) { 267 if (result) {
268 ResourceHostMsg_SyncLoad::WriteReplyParams(sync_result.get(), *result); 268 ResourceHostMsg_SyncLoad::WriteReplyParams(sync_result.get(), *result);
269 } else { 269 } else {
270 sync_result->set_reply_error(); 270 sync_result->set_reply_error();
271 } 271 }
272 filter->Send(sync_result.release()); 272 filter->Send(sync_result.release());
273 } 273 }
274 274
275 // Used to log the cache flags for back-forward navigation requests.
Ilya Sherman 2017/06/13 21:38:00 Please document that this is used to back an UMA h
clamy 2017/06/14 13:26:50 Done.
276 // TODO(clamy): Remove this once we know the reason behind PlzNavigate's
277 // regression on PLT for back forward navigations.
278 enum HistogramCacheFlag {
279 HISTOGRAM_VALIDATE_CACHE,
280 HISTOGRAM_BYPASS_CACHE,
281 HISTOGRAM_SKIP_CACHE_VALIDATION,
282 HISTOGRAM_ONLY_FROM_CACHE,
283 HISTOGRAM_DISABLE_CACHE,
284 HISTOGRAM_CACHE_FLAG_MAX = HISTOGRAM_DISABLE_CACHE,
285 };
286
287 void LogBackForwardNavigationFlagsHistogram(int load_flags) {
288 if (load_flags & net::LOAD_VALIDATE_CACHE) {
289 UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags",
290 HISTOGRAM_VALIDATE_CACHE,
291 HISTOGRAM_CACHE_FLAG_MAX);
Ilya Sherman 2017/06/13 21:38:00 nit: Please create a small wrapper function, that
clamy 2017/06/14 13:26:50 Done.
292 }
293 if (load_flags & net::LOAD_BYPASS_CACHE) {
294 UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags",
295 HISTOGRAM_BYPASS_CACHE, HISTOGRAM_CACHE_FLAG_MAX);
296 }
297 if (load_flags & net::LOAD_SKIP_CACHE_VALIDATION) {
298 UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags",
299 HISTOGRAM_SKIP_CACHE_VALIDATION,
300 HISTOGRAM_CACHE_FLAG_MAX);
301 }
302 if (load_flags & net::LOAD_ONLY_FROM_CACHE) {
303 UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags",
304 HISTOGRAM_ONLY_FROM_CACHE,
305 HISTOGRAM_CACHE_FLAG_MAX);
306 }
307 if (load_flags & net::LOAD_VALIDATE_CACHE) {
308 UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags",
309 HISTOGRAM_VALIDATE_CACHE,
310 HISTOGRAM_CACHE_FLAG_MAX);
311 }
312 }
313
275 } // namespace 314 } // namespace
276 315
277 ResourceDispatcherHostImpl::LoadInfo::LoadInfo() {} 316 ResourceDispatcherHostImpl::LoadInfo::LoadInfo() {}
278 ResourceDispatcherHostImpl::LoadInfo::LoadInfo(const LoadInfo& other) = default; 317 ResourceDispatcherHostImpl::LoadInfo::LoadInfo(const LoadInfo& other) = default;
279 ResourceDispatcherHostImpl::LoadInfo::~LoadInfo() {} 318 ResourceDispatcherHostImpl::LoadInfo::~LoadInfo() {}
280 319
281 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} 320 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {}
282 321
283 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} 322 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {}
284 323
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 return kAvgBytesPerOutstandingRequest + strings_cost; 2232 return kAvgBytesPerOutstandingRequest + strings_cost;
2194 } 2233 }
2195 2234
2196 void ResourceDispatcherHostImpl::BeginRequestInternal( 2235 void ResourceDispatcherHostImpl::BeginRequestInternal(
2197 std::unique_ptr<net::URLRequest> request, 2236 std::unique_ptr<net::URLRequest> request,
2198 std::unique_ptr<ResourceHandler> handler) { 2237 std::unique_ptr<ResourceHandler> handler) {
2199 DCHECK(!request->is_pending()); 2238 DCHECK(!request->is_pending());
2200 ResourceRequestInfoImpl* info = 2239 ResourceRequestInfoImpl* info =
2201 ResourceRequestInfoImpl::ForRequest(request.get()); 2240 ResourceRequestInfoImpl::ForRequest(request.get());
2202 2241
2242 // Log metrics for back-forward navigations.
2243 // TODO(clamy): Remove this once we understand the reason behind the
2244 // back-forward PLT regression with PlzNavigate
2245 if ((info->GetPageTransition() & ui::PAGE_TRANSITION_FORWARD_BACK) &&
2246 IsResourceTypeFrame(info->GetResourceType())) {
nasko 2017/06/13 23:50:08 Since we care only about main resources, shouldn't
clamy 2017/06/14 13:26:50 Yes the goal is to compare between PlzNavigate and
2247 LogBackForwardNavigationFlagsHistogram(request->load_flags());
2248 }
2249
2203 if ((TimeTicks::Now() - last_user_gesture_time_) < 2250 if ((TimeTicks::Now() - last_user_gesture_time_) <
2204 TimeDelta::FromMilliseconds(kUserGestureWindowMs)) { 2251 TimeDelta::FromMilliseconds(kUserGestureWindowMs)) {
2205 request->SetLoadFlags(request->load_flags() | net::LOAD_MAYBE_USER_GESTURE); 2252 request->SetLoadFlags(request->load_flags() | net::LOAD_MAYBE_USER_GESTURE);
2206 } 2253 }
2207 2254
2208 // Add the memory estimate that starting this request will consume. 2255 // Add the memory estimate that starting this request will consume.
2209 info->set_memory_cost(CalculateApproximateMemoryCost(request.get())); 2256 info->set_memory_cost(CalculateApproximateMemoryCost(request.get()));
2210 2257
2211 // If enqueing/starting this request will exceed our per-process memory 2258 // If enqueing/starting this request will exceed our per-process memory
2212 // bound, abort it right away. 2259 // bound, abort it right away.
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 &throttles); 2703 &throttles);
2657 if (!throttles.empty()) { 2704 if (!throttles.empty()) {
2658 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2705 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2659 std::move(throttles))); 2706 std::move(throttles)));
2660 } 2707 }
2661 } 2708 }
2662 return handler; 2709 return handler;
2663 } 2710 }
2664 2711
2665 } // namespace content 2712 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698