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

Side by Side Diff: chrome/browser/predictors/loading_stats_collector.h

Issue 2937623007: predictors: Move more methods from ResourcePrefetchPredictor into LoadingDataCollector. (Closed)
Patch Set: Combine RecordMainFrameLoadComplete and OnNavigationComplete. 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CHROME_BROWSER_PREDICTORS_LOADING_STATS_COLLECTOR_H_ 5 #ifndef CHROME_BROWSER_PREDICTORS_LOADING_STATS_COLLECTOR_H_
6 #define CHROME_BROWSER_PREDICTORS_LOADING_STATS_COLLECTOR_H_ 6 #define CHROME_BROWSER_PREDICTORS_LOADING_STATS_COLLECTOR_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 15 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
alexilin 2017/06/16 09:31:57 nit: We can use just a forward declaration of Reso
trevordixon 2017/06/16 10:53:19 Done.
16 #include "chrome/browser/predictors/resource_prefetcher.h" 16 #include "chrome/browser/predictors/resource_prefetcher.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace predictors { 19 namespace predictors {
20 20
21 namespace internal { 21 namespace internal {
22 constexpr char kResourcePrefetchPredictorPrecisionHistogram[] = 22 constexpr char kResourcePrefetchPredictorPrecisionHistogram[] =
23 "ResourcePrefetchPredictor.LearningPrecision"; 23 "ResourcePrefetchPredictor.LearningPrecision";
24 constexpr char kResourcePrefetchPredictorRecallHistogram[] = 24 constexpr char kResourcePrefetchPredictorRecallHistogram[] =
25 "ResourcePrefetchPredictor.LearningRecall"; 25 "ResourcePrefetchPredictor.LearningRecall";
(...skipping 23 matching lines...) Expand all
49 const LoadingPredictorConfig& config); 49 const LoadingPredictorConfig& config);
50 ~LoadingStatsCollector(); 50 ~LoadingStatsCollector();
51 51
52 // Records statistics about a finished prefetching operation. 52 // Records statistics about a finished prefetching operation.
53 void RecordPrefetcherStats( 53 void RecordPrefetcherStats(
54 std::unique_ptr<ResourcePrefetcher::PrefetcherStats> stats); 54 std::unique_ptr<ResourcePrefetcher::PrefetcherStats> stats);
55 // Records a summary of a page load. The summary is collated with speculative 55 // Records a summary of a page load. The summary is collated with speculative
56 // actions taken for a given page load if any. The summary is compared with a 56 // actions taken for a given page load if any. The summary is compared with a
57 // prediction by ResourcePrefetchPredictor as well. 57 // prediction by ResourcePrefetchPredictor as well.
58 // All results are reported to UMA. 58 // All results are reported to UMA.
59 void RecordPageRequestSummary( 59 void RecordPageRequestSummary(const PageRequestSummary& summary);
60 const ResourcePrefetchPredictor::PageRequestSummary& summary);
61 // Evicts all stale stats that are kept in memory. All speculative actions are 60 // Evicts all stale stats that are kept in memory. All speculative actions are
62 // reported and considered as waste. 61 // reported and considered as waste.
63 void CleanupAbandonedStats(); 62 void CleanupAbandonedStats();
64 63
65 private: 64 private:
66 ResourcePrefetchPredictor* predictor_; 65 ResourcePrefetchPredictor* predictor_;
67 base::TimeDelta max_stats_age_; 66 base::TimeDelta max_stats_age_;
68 std::map<GURL, std::unique_ptr<ResourcePrefetcher::PrefetcherStats>> 67 std::map<GURL, std::unique_ptr<ResourcePrefetcher::PrefetcherStats>>
69 prefetcher_stats_; 68 prefetcher_stats_;
70 69
71 DISALLOW_COPY_AND_ASSIGN(LoadingStatsCollector); 70 DISALLOW_COPY_AND_ASSIGN(LoadingStatsCollector);
72 }; 71 };
73 72
74 } // namespace predictors 73 } // namespace predictors
75 74
76 #endif // CHROME_BROWSER_PREDICTORS_LOADING_STATS_COLLECTOR_H_ 75 #endif // CHROME_BROWSER_PREDICTORS_LOADING_STATS_COLLECTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698