| 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
|
|
|