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

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

Issue 2719533002: predictors: Add RedirectStatus histogram + fix redirects related bug. (Closed)
Patch Set: Nit. Created 3 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_predictor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/predictors/resource_prefetch_predictor.h
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.h b/chrome/browser/predictors/resource_prefetch_predictor.h
index 25514ab542773e8c4b720d0267fb1cb6c91a42a2..60f057c23ec67f49667a4299998307bd05e1fdb4 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.h
+++ b/chrome/browser/predictors/resource_prefetch_predictor.h
@@ -59,6 +59,8 @@ constexpr char kResourcePrefetchPredictorPrefetchHitsSize[] =
"ResourcePrefetchPredictor.PrefetchHitsSizeKB";
constexpr char kResourcePrefetchPredictorPrefetchMissesSize[] =
"ResourcePrefetchPredictor.PrefetchMissesSizeKB";
+constexpr char kResourcePrefetchPredictorRedirectStatusHistogram[] =
+ "ResourcePrefetchPredictor.RedirectStatus";
} // namespace internal
class TestObserver;
@@ -140,6 +142,31 @@ class ResourcePrefetchPredictor
std::vector<URLRequestSummary> subresource_requests;
};
+ // Stores a result of prediction. Essentially, |subresource_urls| is main
+ // result and other fields are used for diagnosis and histograms reporting.
+ struct Prediction {
+ Prediction();
+ Prediction(const Prediction& other);
+ ~Prediction();
+
+ bool is_host;
+ bool is_redirected;
+ std::string main_frame_key;
+ std::vector<GURL> subresource_urls;
+ };
+
+ // Used for reporting redirect prediction success/failure in histograms.
+ // NOTE: This enumeration is used in histograms, so please do not add entries
+ // in the middle.
+ enum class RedirectStatus {
+ NO_REDIRECT,
+ NO_REDIRECT_BUT_PREDICTED,
+ REDIRECT_NOT_PREDICTED,
+ REDIRECT_WRONG_PREDICTED,
+ REDIRECT_CORRECTLY_PREDICTED,
+ MAX
+ };
+
ResourcePrefetchPredictor(const ResourcePrefetchPredictorConfig& config,
Profile* profile);
~ResourcePrefetchPredictor() override;
@@ -278,10 +305,11 @@ class ResourcePrefetchPredictor
void OnNavigationComplete(const NavigationID& nav_id_without_timing_info);
// Returns true iff there is PrefetchData that can be used for a
- // |main_frame_url| and fills |urls| with resources that need to be
- // prefetched. |urls| pointer may be equal nullptr to get return value only.
+ // |main_frame_url| and fills |prediction| with resources that need to be
+ // prefetched. |prediction| pointer may be equal nullptr to get return value
+ // only.
bool GetPrefetchData(const GURL& main_frame_url,
- std::vector<GURL>* urls) const;
+ Prediction* prediction) const;
// Returns true iff the |data_map| contains PrefetchData that can be used
// for a |main_frame_key| and fills |urls| with resources that need to be
« no previous file with comments | « no previous file | chrome/browser/predictors/resource_prefetch_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698