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

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: Addressed comments 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.
276 // Because this enum is used to back a histogrma, DO NOT REMOVE OR RENAME VALUES
277 // in this enum. Instead, add a new one at the end.
278 // TODO(clamy): Remove this once we know the reason behind PlzNavigate's
279 // regression on PLT for back forward navigations.
280 enum HistogramCacheFlag {
281 HISTOGRAM_VALIDATE_CACHE,
282 HISTOGRAM_BYPASS_CACHE,
283 HISTOGRAM_SKIP_CACHE_VALIDATION,
284 HISTOGRAM_ONLY_FROM_CACHE,
285 HISTOGRAM_DISABLE_CACHE,
286 HISTOGRAM_CACHE_FLAG_MAX = HISTOGRAM_DISABLE_CACHE,
287 };
288
289 void RecordCacheFlags(HistogramCacheFlag flag) {
290 UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags", flag,
291 HISTOGRAM_CACHE_FLAG_MAX);
292 }
293
294 void LogBackForwardNavigationFlagsHistogram(int load_flags) {
295 if (load_flags & net::LOAD_VALIDATE_CACHE)
296 RecordCacheFlags(HISTOGRAM_VALIDATE_CACHE);
297
298 if (load_flags & net::LOAD_BYPASS_CACHE)
299 RecordCacheFlags(HISTOGRAM_BYPASS_CACHE);
300
301 if (load_flags & net::LOAD_SKIP_CACHE_VALIDATION)
302 RecordCacheFlags(HISTOGRAM_SKIP_CACHE_VALIDATION);
303
304 if (load_flags & net::LOAD_ONLY_FROM_CACHE)
305 RecordCacheFlags(HISTOGRAM_ONLY_FROM_CACHE);
306
307 if (load_flags & net::LOAD_DISABLE_CACHE)
308 RecordCacheFlags(HISTOGRAM_DISABLE_CACHE);
309 }
310
275 } // namespace 311 } // namespace
276 312
277 ResourceDispatcherHostImpl::LoadInfo::LoadInfo() {} 313 ResourceDispatcherHostImpl::LoadInfo::LoadInfo() {}
278 ResourceDispatcherHostImpl::LoadInfo::LoadInfo(const LoadInfo& other) = default; 314 ResourceDispatcherHostImpl::LoadInfo::LoadInfo(const LoadInfo& other) = default;
279 ResourceDispatcherHostImpl::LoadInfo::~LoadInfo() {} 315 ResourceDispatcherHostImpl::LoadInfo::~LoadInfo() {}
280 316
281 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {} 317 ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo() {}
282 318
283 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {} 319 ResourceDispatcherHostImpl::HeaderInterceptorInfo::~HeaderInterceptorInfo() {}
284 320
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
2193 return kAvgBytesPerOutstandingRequest + strings_cost; 2229 return kAvgBytesPerOutstandingRequest + strings_cost;
2194 } 2230 }
2195 2231
2196 void ResourceDispatcherHostImpl::BeginRequestInternal( 2232 void ResourceDispatcherHostImpl::BeginRequestInternal(
2197 std::unique_ptr<net::URLRequest> request, 2233 std::unique_ptr<net::URLRequest> request,
2198 std::unique_ptr<ResourceHandler> handler) { 2234 std::unique_ptr<ResourceHandler> handler) {
2199 DCHECK(!request->is_pending()); 2235 DCHECK(!request->is_pending());
2200 ResourceRequestInfoImpl* info = 2236 ResourceRequestInfoImpl* info =
2201 ResourceRequestInfoImpl::ForRequest(request.get()); 2237 ResourceRequestInfoImpl::ForRequest(request.get());
2202 2238
2239 // Log metrics for back-forward navigations.
2240 // TODO(clamy): Remove this once we understand the reason behind the
2241 // back-forward PLT regression with PlzNavigate
2242 if ((info->GetPageTransition() & ui::PAGE_TRANSITION_FORWARD_BACK) &&
2243 IsResourceTypeFrame(info->GetResourceType())) {
2244 LogBackForwardNavigationFlagsHistogram(request->load_flags());
2245 }
2246
2203 if ((TimeTicks::Now() - last_user_gesture_time_) < 2247 if ((TimeTicks::Now() - last_user_gesture_time_) <
2204 TimeDelta::FromMilliseconds(kUserGestureWindowMs)) { 2248 TimeDelta::FromMilliseconds(kUserGestureWindowMs)) {
2205 request->SetLoadFlags(request->load_flags() | net::LOAD_MAYBE_USER_GESTURE); 2249 request->SetLoadFlags(request->load_flags() | net::LOAD_MAYBE_USER_GESTURE);
2206 } 2250 }
2207 2251
2208 // Add the memory estimate that starting this request will consume. 2252 // Add the memory estimate that starting this request will consume.
2209 info->set_memory_cost(CalculateApproximateMemoryCost(request.get())); 2253 info->set_memory_cost(CalculateApproximateMemoryCost(request.get()));
2210 2254
2211 // If enqueing/starting this request will exceed our per-process memory 2255 // If enqueing/starting this request will exceed our per-process memory
2212 // bound, abort it right away. 2256 // bound, abort it right away.
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 &throttles); 2700 &throttles);
2657 if (!throttles.empty()) { 2701 if (!throttles.empty()) {
2658 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2702 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2659 std::move(throttles))); 2703 std::move(throttles)));
2660 } 2704 }
2661 } 2705 }
2662 return handler; 2706 return handler;
2663 } 2707 }
2664 2708
2665 } // namespace content 2709 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698