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

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

Issue 2937623007: predictors: Move more methods from ResourcePrefetchPredictor into LoadingDataCollector. (Closed)
Patch Set: Make InitializationState type public. 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 side-by-side diff with in-line comments
Download patch
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 a9e9c0325736f1fcb450c97b3c7f9d7107874988..5e5073b38a8914435bd3e8567d6dad32287fd625 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.h
+++ b/chrome/browser/predictors/resource_prefetch_predictor.h
@@ -179,6 +179,12 @@ class ResourcePrefetchPredictor
std::vector<GURL> subresource_urls;
};
+ enum InitializationState {
+ NOT_INITIALIZED = 0,
+ INITIALIZING = 1,
+ INITIALIZED = 2
+ };
+
// 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.
@@ -244,21 +250,6 @@ class ResourcePrefetchPredictor
Prediction* prediction) const;
private:
- // 'LoadingPredictorObserver' calls the below functions to inform the
- // predictor of main frame and resource requests. Should only be called if the
- // corresponding Should* functions return true.
- void RecordURLRequest(const URLRequestSummary& request);
- void RecordURLResponse(const URLRequestSummary& response);
- void RecordURLRedirect(const URLRequestSummary& response);
-
- // Called when the main frame of a page completes loading.
- void RecordMainFrameLoadComplete(const NavigationID& navigation_id);
-
- // Called after the main frame's first contentful paint.
- void RecordFirstContentfulPaint(
- const NavigationID& navigation_id,
- const base::TimeTicks& first_contentful_paint);
-
// Starts prefetching for |main_frame_url| from a |prediction|.
void StartPrefetching(const GURL& main_frame_url,
const Prediction& prediction);
@@ -309,11 +300,6 @@ class ResourcePrefetchPredictor
FRIEND_TEST_ALL_PREFIXES(ResourcePrefetchPredictorTest,
TestRecordFirstContentfulPaint);
- enum InitializationState {
- NOT_INITIALIZED = 0,
- INITIALIZING = 1,
- INITIALIZED = 2
- };
typedef GlowplugKeyValueData<PrefetchData, internal::LastVisitTimeCompare>
PrefetchDataMap;
typedef GlowplugKeyValueData<RedirectData, internal::LastVisitTimeCompare>
@@ -329,17 +315,9 @@ class ResourcePrefetchPredictor
// Returns true if the request (should have a response in it) is "no-store".
static bool IsNoStore(const net::URLRequest& request);
- // Functions called on different network events pertaining to the loading of
- // main frame resource or sub resources.
- void OnMainFrameRequest(const URLRequestSummary& request);
- void OnMainFrameRedirect(const URLRequestSummary& response);
- void OnSubresourceResponse(const URLRequestSummary& response);
- void OnSubresourceRedirect(const URLRequestSummary& response);
-
- // Called when onload completes for a navigation. We treat this point as the
- // "completion" of the navigation. The resources requested by the page up to
- // this point are the only ones considered for prefetching.
- void OnNavigationComplete(const NavigationID& nav_id_without_timing_info);
+ // Called by the collector after a page has finished loading resources and
+ // assembled a PageRequestSummary.
+ void HandlePageRequestSummary(std::unique_ptr<PageRequestSummary> summary);
alexilin 2017/06/14 11:41:54 s/HandlePageRequestSummary/RecordPageRequestSummar
trevordixon 2017/06/16 05:11:28 Done.
alexilin 2017/06/16 09:31:57 You didn't rename the method :)
trevordixon 2017/06/16 10:53:19 Oops, missed that line! Done.
// Returns true iff one of the following conditions is true
// * |redirect_data| contains confident redirect endpoint for |entry_point|
@@ -370,9 +348,6 @@ class ResourcePrefetchPredictor
// database has been read.
void OnHistoryAndCacheLoaded();
- // Cleanup inflight_navigations_ and call a cleanup for stats_collector_.
- void CleanupAbandonedNavigations(const NavigationID& navigation_id);
-
// Deletes all URLs from the predictor database, the caches and removes all
// inflight navigations.
void DeleteAllUrls();
@@ -423,6 +398,8 @@ class ResourcePrefetchPredictor
// notificatioan.
void ConnectToHistoryService();
+ InitializationState initialization_state() { return initialization_state_; }
+
// Used for testing to inject mock tables.
void set_mock_tables(scoped_refptr<ResourcePrefetchPredictorTables> tables) {
tables_ = tables;

Powered by Google App Engine
This is Rietveld 408576698