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

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

Issue 2538743002: predictors: Add a origin for prefetch requests, remove the URL/host settings. (Closed)
Patch Set: . Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_RESOURCE_PREFETCH_PREDICTOR_H_ 5 #ifndef CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 6 #define CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 // 'ResourcePrefetchPredictorObserver' calls the below functions to inform the 144 // 'ResourcePrefetchPredictorObserver' calls the below functions to inform the
145 // predictor of main frame and resource requests. Should only be called if the 145 // predictor of main frame and resource requests. Should only be called if the
146 // corresponding Should* functions return true. 146 // corresponding Should* functions return true.
147 void RecordURLRequest(const URLRequestSummary& request); 147 void RecordURLRequest(const URLRequestSummary& request);
148 void RecordURLResponse(const URLRequestSummary& response); 148 void RecordURLResponse(const URLRequestSummary& response);
149 void RecordURLRedirect(const URLRequestSummary& response); 149 void RecordURLRedirect(const URLRequestSummary& response);
150 150
151 // Called when the main frame of a page completes loading. 151 // Called when the main frame of a page completes loading.
152 void RecordMainFrameLoadComplete(const NavigationID& navigation_id); 152 void RecordMainFrameLoadComplete(const NavigationID& navigation_id);
153 153
154 // Starts prefetching if it is enabled and prefetching data exists for the 154 // Starts prefetching if it is enabled for |origin| and prefetching data
155 // |main_frame_url| either at the URL or at the host level. 155 // exists for the |main_frame_url| either at the URL or at the host level.
156 void StartPrefetching(const GURL& main_frame_url); 156 void StartPrefetching(const GURL& main_frame_url, PrefetchOrigin origin);
157 157
158 // Stops prefetching that may be in progress corresponding to 158 // Stops prefetching that may be in progress corresponding to
159 // |main_frame_url|. 159 // |main_frame_url|.
160 void StopPrefetching(const GURL& main_frame_url); 160 void StopPrefetching(const GURL& main_frame_url);
161 161
162 // Sets the |observer| to be notified when the resource prefetch predictor 162 // Sets the |observer| to be notified when the resource prefetch predictor
163 // data changes. Previously registered observer will be discarded. Call 163 // data changes. Previously registered observer will be discarded. Call
164 // this with nullptr parameter to de-register observer. 164 // this with nullptr parameter to de-register observer.
165 void SetObserverForTesting(TestObserver* observer); 165 void SetObserverForTesting(TestObserver* observer);
166 166
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 375
376 private: 376 private:
377 ResourcePrefetchPredictor* predictor_; 377 ResourcePrefetchPredictor* predictor_;
378 378
379 DISALLOW_COPY_AND_ASSIGN(TestObserver); 379 DISALLOW_COPY_AND_ASSIGN(TestObserver);
380 }; 380 };
381 381
382 } // namespace predictors 382 } // namespace predictors
383 383
384 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ 384 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698