Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 | 236 |
| 237 // Called when onload completes for a navigation. We treat this point as the | 237 // Called when onload completes for a navigation. We treat this point as the |
| 238 // "completion" of the navigation. The resources requested by the page up to | 238 // "completion" of the navigation. The resources requested by the page up to |
| 239 // this point are the only ones considered for prefetching. | 239 // this point are the only ones considered for prefetching. |
| 240 void OnNavigationComplete(const NavigationID& nav_id_without_timing_info); | 240 void OnNavigationComplete(const NavigationID& nav_id_without_timing_info); |
| 241 | 241 |
| 242 // Returns true if there is PrefetchData that can be used for a URL and fills | 242 // Returns true if there is PrefetchData that can be used for a URL and fills |
| 243 // |urls| with resources that need to be prefetched. | 243 // |urls| with resources that need to be prefetched. |
| 244 bool GetPrefetchData(const GURL& main_frame_url, std::vector<GURL>* urls); | 244 bool GetPrefetchData(const GURL& main_frame_url, std::vector<GURL>* urls); |
| 245 | 245 |
| 246 // Returns true if the URL-based table contains PrefetchData that can be | |
|
pasko
2016/10/07 11:42:43
not fully true, since the |urls| could be non-empt
alexilin
2016/10/07 13:09:29
Yeah, excellent observation!
Nevertheless, I thin
| |
| 247 // used for a |main_frame_url| and fills |urls| with resources that need to be | |
| 248 // prefetched. | |
| 249 bool GetURLPrefetchData(const std::string& main_frame_url, | |
| 250 std::vector<GURL>* urls); | |
| 251 | |
| 252 // Returns true if the host-based table contains PrefetchData that can be used | |
|
pasko
2016/10/07 11:42:43
It is preferable to write 'iff' in this case (iff
alexilin
2016/10/07 13:09:29
Done.
| |
| 253 // for a |main_frame_host| and fills |urls| with resources that need to be | |
| 254 // prefetched. | |
| 255 bool GetHostPrefetchData(const std::string& main_frame_host, | |
| 256 std::vector<GURL>* urls); | |
| 257 | |
| 246 // Converts a PrefetchData into a list of URLs. | 258 // Converts a PrefetchData into a list of URLs. |
| 247 void PopulatePrefetcherRequest(const PrefetchData& data, | 259 void PopulatePrefetcherRequest(const PrefetchData& data, |
| 248 std::vector<GURL>* urls); | 260 std::vector<GURL>* urls); |
| 249 | 261 |
| 262 // Returns true if |redirect_data_map| contains confident redirect endpoint | |
| 263 // for |first_redirect| and assign it to the |final_redirect|. | |
| 264 bool GetFinalRedirect(const std::string& first_redirect, | |
|
pasko
2016/10/07 11:42:43
this seems not to require any state of the object.
alexilin
2016/10/07 13:09:29
Implemented the second one because "we have many".
| |
| 265 RedirectDataMap* redirect_data_map, | |
| 266 std::string* final_redirect); | |
| 267 | |
| 250 public: | 268 public: |
| 251 // Starts prefetching if it is enabled and prefetching data exists for the | 269 // Starts prefetching if it is enabled and prefetching data exists for the |
| 252 // NavigationID either at the URL or at the host level. | 270 // NavigationID either at the URL or at the host level. |
| 253 void StartPrefetching(const GURL& main_frame_url); | 271 void StartPrefetching(const GURL& main_frame_url); |
| 254 | 272 |
| 255 // Stops prefetching that may be in progress corresponding to |navigation_id|. | 273 // Stops prefetching that may be in progress corresponding to |navigation_id|. |
| 256 void StopPrefetching(const GURL& main_frame_url); | 274 void StopPrefetching(const GURL& main_frame_url); |
| 257 | 275 |
| 258 private: | 276 private: |
| 259 // Starts initialization by posting a task to the DB thread to read the | 277 // Starts initialization by posting a task to the DB thread to read the |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 359 | 377 |
| 360 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 378 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
| 361 history_service_observer_; | 379 history_service_observer_; |
| 362 | 380 |
| 363 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); | 381 DISALLOW_COPY_AND_ASSIGN(ResourcePrefetchPredictor); |
| 364 }; | 382 }; |
| 365 | 383 |
| 366 } // namespace predictors | 384 } // namespace predictors |
| 367 | 385 |
| 368 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ | 386 #endif // CHROME_BROWSER_PREDICTORS_RESOURCE_PREFETCH_PREDICTOR_H_ |
| OLD | NEW |