| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_PRERENDER_PRERENDER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // destroyed as well. | 194 // destroyed as well. |
| 195 // | 195 // |
| 196 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is | 196 // If the CLEAR_PRERENDER_HISTORY bit is set, the prerender history is |
| 197 // cleared, including any entries newly created by destroying them in | 197 // cleared, including any entries newly created by destroying them in |
| 198 // response to the CLEAR_PRERENDER_CONTENTS flag. | 198 // response to the CLEAR_PRERENDER_CONTENTS flag. |
| 199 // | 199 // |
| 200 // Intended to be used when clearing the cache or history. | 200 // Intended to be used when clearing the cache or history. |
| 201 void ClearData(int clear_flags); | 201 void ClearData(int clear_flags); |
| 202 | 202 |
| 203 // Record a final status of a prerendered page in a histogram. | 203 // Record a final status of a prerendered page in a histogram. |
| 204 void RecordFinalStatus(Origin origin, | 204 // This variation allows specifying whether prerendering had been started |
| 205 uint8 experiment_id, | 205 // (necessary to flag MatchComplete dummies). |
| 206 FinalStatus final_status) const; | 206 void RecordFinalStatusWithMatchCompleteStatus( |
| 207 Origin origin, |
| 208 uint8 experiment_id, |
| 209 PrerenderContents::MatchCompleteStatus mc_status, |
| 210 FinalStatus final_status) const; |
| 207 | 211 |
| 208 const Config& config() const { return config_; } | 212 const Config& config() const { return config_; } |
| 209 Config& mutable_config() { return config_; } | 213 Config& mutable_config() { return config_; } |
| 210 | 214 |
| 211 PrerenderTracker* prerender_tracker() { return prerender_tracker_; } | 215 PrerenderTracker* prerender_tracker() { return prerender_tracker_; } |
| 212 | 216 |
| 213 // Adds a condition. This is owned by the PrerenderManager. | 217 // Adds a condition. This is owned by the PrerenderManager. |
| 214 void AddCondition(const PrerenderCondition* condition); | 218 void AddCondition(const PrerenderCondition* condition); |
| 215 | 219 |
| 216 bool IsTopSite(const GURL& url); | 220 bool IsTopSite(const GURL& url); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 236 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ClearTest); | 240 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ClearTest); |
| 237 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ControlGroup); | 241 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ControlGroup); |
| 238 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, DropOldestRequestTest); | 242 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, DropOldestRequestTest); |
| 239 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, DropSecondRequestTest); | 243 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, DropSecondRequestTest); |
| 240 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExpireTest); | 244 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExpireTest); |
| 241 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, FoundTest); | 245 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, FoundTest); |
| 242 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, FragmentMatchesFragmentTest); | 246 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, FragmentMatchesFragmentTest); |
| 243 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, FragmentMatchesPageTest); | 247 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, FragmentMatchesPageTest); |
| 244 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, PageMatchesFragmentTest); | 248 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, PageMatchesFragmentTest); |
| 245 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, PendingPrerenderTest); | 249 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, PendingPrerenderTest); |
| 250 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ControlGroupVisited); |
| 251 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, NoUseGroupVisited); |
| 246 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, RateLimitInWindowTest); | 252 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, RateLimitInWindowTest); |
| 247 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, RateLimitOutsideWindowTest); | 253 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, RateLimitOutsideWindowTest); |
| 248 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, SourceRenderViewClosed); | 254 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, SourceRenderViewClosed); |
| 249 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, TwoElementPrerenderTest); | 255 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, TwoElementPrerenderTest); |
| 250 | 256 |
| 251 struct PrerenderContentsData; | 257 struct PrerenderContentsData; |
| 252 struct NavigationRecord; | 258 struct NavigationRecord; |
| 253 | 259 |
| 254 class OnCloseTabContentsDeleter; | 260 class OnCloseTabContentsDeleter; |
| 255 | 261 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 | 367 |
| 362 // Returns a new Value representing the pages currently being prerendered. The | 368 // Returns a new Value representing the pages currently being prerendered. The |
| 363 // caller is responsible for delete'ing the return value. | 369 // caller is responsible for delete'ing the return value. |
| 364 base::Value* GetActivePrerendersAsValue() const; | 370 base::Value* GetActivePrerendersAsValue() const; |
| 365 | 371 |
| 366 // Destroys all pending prerenders using FinalStatus. Also deletes them as | 372 // Destroys all pending prerenders using FinalStatus. Also deletes them as |
| 367 // well as any swapped out TabContents queued for destruction. | 373 // well as any swapped out TabContents queued for destruction. |
| 368 // Used both on destruction, and when clearing the browsing history. | 374 // Used both on destruction, and when clearing the browsing history. |
| 369 void DestroyAllContents(FinalStatus final_status); | 375 void DestroyAllContents(FinalStatus final_status); |
| 370 | 376 |
| 377 // Helper function to destroy a PrerenderContents with the specified |
| 378 // final_status, while at the same time recording that for the MatchComplete |
| 379 // case, that this prerender would have been used. |
| 380 void DestroyAndMarkMatchCompleteAsUsed(PrerenderContents* prerender_contents, |
| 381 FinalStatus final_status); |
| 382 |
| 383 // Record a final status of a prerendered page in a histogram. |
| 384 // This is a helper function which will ultimately call |
| 385 // RecordFinalStatusWthMatchCompleteStatus, using MATCH_COMPLETE_DEFAULT. |
| 386 void RecordFinalStatus(Origin origin, |
| 387 uint8 experiment_id, |
| 388 FinalStatus final_status) const; |
| 389 |
| 371 // The configuration. | 390 // The configuration. |
| 372 Config config_; | 391 Config config_; |
| 373 | 392 |
| 374 // Specifies whether prerendering is currently enabled for this | 393 // Specifies whether prerendering is currently enabled for this |
| 375 // manager. The value can change dynamically during the lifetime | 394 // manager. The value can change dynamically during the lifetime |
| 376 // of the PrerenderManager. | 395 // of the PrerenderManager. |
| 377 bool enabled_; | 396 bool enabled_; |
| 378 | 397 |
| 379 // The profile that owns this PrerenderManager. | 398 // The profile that owns this PrerenderManager. |
| 380 Profile* profile_; | 399 Profile* profile_; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 | 449 |
| 431 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 450 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 432 }; | 451 }; |
| 433 | 452 |
| 434 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 453 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
| 435 int render_process_id); | 454 int render_process_id); |
| 436 | 455 |
| 437 } // namespace prerender | 456 } // namespace prerender |
| 438 | 457 |
| 439 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 458 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |