Chromium Code Reviews| Index: content/browser/loader/resource_dispatcher_host_impl.cc |
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
| index 300a222f6acc42fbebe46bb6efe44d9f17e486ca..1807e9174956d92c5df6ba65a107ef1566fca6ed 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -272,6 +272,45 @@ void HandleSyncLoadResult(base::WeakPtr<ResourceMessageFilter> filter, |
| filter->Send(sync_result.release()); |
| } |
| +// 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.
|
| +// TODO(clamy): Remove this once we know the reason behind PlzNavigate's |
| +// regression on PLT for back forward navigations. |
| +enum HistogramCacheFlag { |
| + HISTOGRAM_VALIDATE_CACHE, |
| + HISTOGRAM_BYPASS_CACHE, |
| + HISTOGRAM_SKIP_CACHE_VALIDATION, |
| + HISTOGRAM_ONLY_FROM_CACHE, |
| + HISTOGRAM_DISABLE_CACHE, |
| + HISTOGRAM_CACHE_FLAG_MAX = HISTOGRAM_DISABLE_CACHE, |
| +}; |
| + |
| +void LogBackForwardNavigationFlagsHistogram(int load_flags) { |
| + if (load_flags & net::LOAD_VALIDATE_CACHE) { |
| + UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags", |
| + HISTOGRAM_VALIDATE_CACHE, |
| + 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.
|
| + } |
| + if (load_flags & net::LOAD_BYPASS_CACHE) { |
| + UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags", |
| + HISTOGRAM_BYPASS_CACHE, HISTOGRAM_CACHE_FLAG_MAX); |
| + } |
| + if (load_flags & net::LOAD_SKIP_CACHE_VALIDATION) { |
| + UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags", |
| + HISTOGRAM_SKIP_CACHE_VALIDATION, |
| + HISTOGRAM_CACHE_FLAG_MAX); |
| + } |
| + if (load_flags & net::LOAD_ONLY_FROM_CACHE) { |
| + UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags", |
| + HISTOGRAM_ONLY_FROM_CACHE, |
| + HISTOGRAM_CACHE_FLAG_MAX); |
| + } |
| + if (load_flags & net::LOAD_VALIDATE_CACHE) { |
| + UMA_HISTOGRAM_ENUMERATION("Navigation.BackForward.CacheFlags", |
| + HISTOGRAM_VALIDATE_CACHE, |
| + HISTOGRAM_CACHE_FLAG_MAX); |
| + } |
| +} |
| + |
| } // namespace |
| ResourceDispatcherHostImpl::LoadInfo::LoadInfo() {} |
| @@ -2200,6 +2239,14 @@ void ResourceDispatcherHostImpl::BeginRequestInternal( |
| ResourceRequestInfoImpl* info = |
| ResourceRequestInfoImpl::ForRequest(request.get()); |
| + // Log metrics for back-forward navigations. |
| + // TODO(clamy): Remove this once we understand the reason behind the |
| + // back-forward PLT regression with PlzNavigate |
| + if ((info->GetPageTransition() & ui::PAGE_TRANSITION_FORWARD_BACK) && |
| + 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
|
| + LogBackForwardNavigationFlagsHistogram(request->load_flags()); |
| + } |
| + |
| if ((TimeTicks::Now() - last_user_gesture_time_) < |
| TimeDelta::FromMilliseconds(kUserGestureWindowMs)) { |
| request->SetLoadFlags(request->load_flags() | net::LOAD_MAYBE_USER_GESTURE); |