Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 public base::NonThreadSafe, | 62 public base::NonThreadSafe, |
| 63 public ProfileKeyedService { | 63 public ProfileKeyedService { |
| 64 public: | 64 public: |
| 65 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 65 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not |
| 66 // add in the middle. | 66 // add in the middle. |
| 67 enum PrerenderManagerMode { | 67 enum PrerenderManagerMode { |
| 68 PRERENDER_MODE_DISABLED, | 68 PRERENDER_MODE_DISABLED, |
| 69 PRERENDER_MODE_ENABLED, | 69 PRERENDER_MODE_ENABLED, |
| 70 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, | 70 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, |
| 71 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, | 71 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, |
| 72 PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP, | |
|
gavinp
2012/09/13 05:51:16
This should never have been committed! See the com
| |
| 72 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP, | 73 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP, |
| 73 PRERENDER_MODE_MAX | 74 PRERENDER_MODE_MAX |
| 74 }; | 75 }; |
| 75 | 76 |
| 76 // One or more of these flags must be passed to ClearData() to specify just | 77 // One or more of these flags must be passed to ClearData() to specify just |
| 77 // what data to clear. See function declaration for more information. | 78 // what data to clear. See function declaration for more information. |
| 78 enum ClearFlags { | 79 enum ClearFlags { |
| 79 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, | 80 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, |
| 80 CLEAR_PRERENDER_HISTORY = 0x1 << 1, | 81 CLEAR_PRERENDER_HISTORY = 0x1 << 1, |
| 81 CLEAR_MAX = 0x1 << 2 | 82 CLEAR_MAX = 0x1 << 2 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 // TabContents that have been replaced by prerendered TabContents. | 311 // TabContents that have been replaced by prerendered TabContents. |
| 311 // Also identifies and kills PrerenderContents that use too much | 312 // Also identifies and kills PrerenderContents that use too much |
| 312 // resources. | 313 // resources. |
| 313 void PeriodicCleanup(); | 314 void PeriodicCleanup(); |
| 314 | 315 |
| 315 // Posts a task to call PeriodicCleanup. Results in quicker destruction of | 316 // Posts a task to call PeriodicCleanup. Results in quicker destruction of |
| 316 // objects. If |this| is deleted before the task is run, the task will | 317 // objects. If |this| is deleted before the task is run, the task will |
| 317 // automatically be cancelled. | 318 // automatically be cancelled. |
| 318 void PostCleanupTask(); | 319 void PostCleanupTask(); |
| 319 | 320 |
| 321 base::TimeDelta GetMaxAge() const; | |
| 320 bool IsPrerenderElementFresh(const base::Time start) const; | 322 bool IsPrerenderElementFresh(const base::Time start) const; |
| 321 void DeleteOldEntries(); | 323 void DeleteOldEntries(); |
| 322 virtual base::Time GetCurrentTime() const; | 324 virtual base::Time GetCurrentTime() const; |
| 323 virtual base::TimeTicks GetCurrentTimeTicks() const; | 325 virtual base::TimeTicks GetCurrentTimeTicks() const; |
| 324 virtual PrerenderContents* CreatePrerenderContents( | 326 virtual PrerenderContents* CreatePrerenderContents( |
| 325 const GURL& url, | 327 const GURL& url, |
| 326 const content::Referrer& referrer, | 328 const content::Referrer& referrer, |
| 327 Origin origin, | 329 Origin origin, |
| 328 uint8 experiment_id); | 330 uint8 experiment_id); |
| 329 | 331 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 | 453 |
| 452 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 454 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 453 }; | 455 }; |
| 454 | 456 |
| 455 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 457 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
| 456 int render_process_id); | 458 int render_process_id); |
| 457 | 459 |
| 458 } // namespace prerender | 460 } // namespace prerender |
| 459 | 461 |
| 460 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 462 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |