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 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 public: | 71 public: |
| 72 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 72 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not |
| 73 // add in the middle. | 73 // add in the middle. |
| 74 enum PrerenderManagerMode { | 74 enum PrerenderManagerMode { |
| 75 PRERENDER_MODE_DISABLED, | 75 PRERENDER_MODE_DISABLED, |
| 76 PRERENDER_MODE_ENABLED, | 76 PRERENDER_MODE_ENABLED, |
| 77 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, | 77 PRERENDER_MODE_EXPERIMENT_CONTROL_GROUP, |
| 78 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, | 78 PRERENDER_MODE_EXPERIMENT_PRERENDER_GROUP, |
| 79 PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP, | 79 PRERENDER_MODE_EXPERIMENT_5MIN_TTL_GROUP, |
| 80 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP, | 80 PRERENDER_MODE_EXPERIMENT_NO_USE_GROUP, |
| 81 PRERENDER_MODE_EXPERIMENT_ONE_PRERENDER_GROUP, | |
|
dominich
2012/07/19 16:04:38
MULTIPLE_PRERENDER_GROUP
gavinp
2012/07/23 18:35:21
Done.
| |
| 81 PRERENDER_MODE_MAX | 82 PRERENDER_MODE_MAX |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 // One or more of these flags must be passed to ClearData() to specify just | 85 // One or more of these flags must be passed to ClearData() to specify just |
| 85 // what data to clear. See function declaration for more information. | 86 // what data to clear. See function declaration for more information. |
| 86 enum ClearFlags { | 87 enum ClearFlags { |
| 87 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, | 88 CLEAR_PRERENDER_CONTENTS = 0x1 << 0, |
| 88 CLEAR_PRERENDER_HISTORY = 0x1 << 1, | 89 CLEAR_PRERENDER_HISTORY = 0x1 << 1, |
| 89 CLEAR_MAX = 0x1 << 2 | 90 CLEAR_MAX = 0x1 << 2 |
| 90 }; | 91 }; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 306 friend class PrerenderBrowserTest; | 307 friend class PrerenderBrowserTest; |
| 307 friend class PrerenderContents; | 308 friend class PrerenderContents; |
| 308 friend class PrerenderHandle; | 309 friend class PrerenderHandle; |
| 309 friend class UnitTestPrerenderManager; | 310 friend class UnitTestPrerenderManager; |
| 310 | 311 |
| 311 class OnCloseTabContentsDeleter; | 312 class OnCloseTabContentsDeleter; |
| 312 struct NavigationRecord; | 313 struct NavigationRecord; |
| 313 | 314 |
| 314 typedef base::hash_map<content::WebContents*, bool> WouldBePrerenderedMap; | 315 typedef base::hash_map<content::WebContents*, bool> WouldBePrerenderedMap; |
| 315 | 316 |
| 317 // Time interval before a new prerender is allowed. | |
| 318 static const int kMinTimeBetweenPrerendersMs = 500; | |
| 319 | |
| 316 // Time window for which we record old navigations, in milliseconds. | 320 // Time window for which we record old navigations, in milliseconds. |
| 317 static const int kNavigationRecordWindowMs = 5000; | 321 static const int kNavigationRecordWindowMs = 5000; |
| 318 | 322 |
| 319 void OnCancelPrerenderHandle(PrerenderData* prerender_data); | 323 void OnCancelPrerenderHandle(PrerenderData* prerender_data); |
| 320 | 324 |
| 321 // Adds a prerender for |url| from |referrer| initiated from the process | 325 // Adds a prerender for |url| from |referrer| initiated from the process |
| 322 // |child_id|. The |origin| specifies how the prerender was added. If |size| | 326 // |child_id|. The |origin| specifies how the prerender was added. If |size| |
| 323 // is empty, then PrerenderContents::StartPrerendering will instead use a | 327 // is empty, then PrerenderContents::StartPrerendering will instead use a |
| 324 // default from PrerenderConfig. Returns a PrerenderHandle*, owned by the | 328 // default from PrerenderConfig. Returns a PrerenderHandle*, owned by the |
| 325 // caller, or NULL. | 329 // caller, or NULL. |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 | 501 |
| 498 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 502 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 499 }; | 503 }; |
| 500 | 504 |
| 501 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( | 505 PrerenderManager* FindPrerenderManagerUsingRenderProcessId( |
| 502 int render_process_id); | 506 int render_process_id); |
| 503 | 507 |
| 504 } // namespace prerender | 508 } // namespace prerender |
| 505 | 509 |
| 506 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 510 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |