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

Unified Diff: chrome/browser/predictors/resource_prefetcher.h

Issue 2654913004: predictors: Add prefetcher histograms for speculative prefetch. (Closed)
Patch Set: Change histogram range. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/predictors/resource_prefetcher.h
diff --git a/chrome/browser/predictors/resource_prefetcher.h b/chrome/browser/predictors/resource_prefetcher.h
index b92e4dca247ae967a30d01f5ad5e9f18560a4ab9..b59b0037070ce3288c4eb4f539729d2354cc782e 100644
--- a/chrome/browser/predictors/resource_prefetcher.h
+++ b/chrome/browser/predictors/resource_prefetcher.h
@@ -27,6 +27,15 @@ class URLRequestContext;
namespace predictors {
+namespace internal {
+constexpr char kResourcePrefetchPredictorCachePatternHistogram[] =
+ "ResourcePrefetchPredictor.CachePattern";
+constexpr char kResourcePrefetchPredictorPrefetchedCountHistogram[] =
+ "ResourcePrefetchPredictor.PrefetchedCount";
+constexpr char kResourcePrefetchPredictorPrefetchedSizeHistogram[] =
+ "ResourcePrefetchPredictor.PrefetchedSizeKB";
+} // namespace internal
+
// Responsible for prefetching resources for a single main frame URL based on
// the input list of resources.
// - Limits the max number of resources in flight for any host and also across
@@ -81,6 +90,9 @@ class ResourcePrefetcher : public net::URLRequest::Delegate {
// be cached correctly. Stubbed out during testing.
virtual void ReadFullResponse(net::URLRequest* request);
+ // Called after successfull reading of response to save stats for histograms.
+ void RequestComplete(net::URLRequest* request);
+
// net::URLRequest::Delegate methods.
void OnReceivedRedirect(net::URLRequest* request,
const net::RedirectInfo& redirect_info,
@@ -108,7 +120,10 @@ class ResourcePrefetcher : public net::URLRequest::Delegate {
Delegate* const delegate_;
ResourcePrefetchPredictorConfig const config_;
GURL main_frame_url_;
- std::unique_ptr<GURL> urls_;
+
+ // For histogram reports.
+ int64_t prefetched_count_;
Benoit L 2017/01/25 17:22:34 why not int?
alexilin 2017/01/25 17:47:33 Because of return type of URLRequest::GetTotalRece
alexilin 2017/01/26 09:38:59 My bad, I mixed up types for these two fields. My
+ size_t prefetched_bytes_;
std::map<net::URLRequest*, std::unique_ptr<net::URLRequest>>
inflight_requests_;
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetcher.cc » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698