| 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 <map> | 10 #include <map> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 std::size_t operator()(TabContents* value) const { | 34 std::size_t operator()(TabContents* value) const { |
| 35 return reinterpret_cast<std::size_t>(value); | 35 return reinterpret_cast<std::size_t>(value); |
| 36 } | 36 } |
| 37 }; | 37 }; |
| 38 } | 38 } |
| 39 | 39 |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 namespace prerender { | 42 namespace prerender { |
| 43 | 43 |
| 44 class PrerenderCondition; |
| 44 class PrerenderHistory; | 45 class PrerenderHistory; |
| 45 class PrerenderTracker; | 46 class PrerenderTracker; |
| 46 | 47 |
| 47 // PrerenderManager is responsible for initiating and keeping prerendered | 48 // PrerenderManager is responsible for initiating and keeping prerendered |
| 48 // views of webpages. All methods must be called on the UI thread unless | 49 // views of webpages. All methods must be called on the UI thread unless |
| 49 // indicated otherwise. | 50 // indicated otherwise. |
| 50 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, | 51 class PrerenderManager : public base::SupportsWeakPtr<PrerenderManager>, |
| 51 public base::NonThreadSafe { | 52 public base::NonThreadSafe { |
| 52 public: | 53 public: |
| 53 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not | 54 // PrerenderManagerMode is used in a UMA_HISTOGRAM, so please do not |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void ClearData(int clear_flags); | 189 void ClearData(int clear_flags); |
| 189 | 190 |
| 190 // Record a final status of a prerendered page in a histogram. | 191 // Record a final status of a prerendered page in a histogram. |
| 191 void RecordFinalStatus(Origin origin, | 192 void RecordFinalStatus(Origin origin, |
| 192 uint8 experiment_id, | 193 uint8 experiment_id, |
| 193 FinalStatus final_status) const; | 194 FinalStatus final_status) const; |
| 194 | 195 |
| 195 const Config& config() const { return config_; } | 196 const Config& config() const { return config_; } |
| 196 Config& mutable_config() { return config_; } | 197 Config& mutable_config() { return config_; } |
| 197 | 198 |
| 199 // Adds a condition. This is owned by the PrerenderManager. |
| 200 void AddCondition(const PrerenderCondition* condition); |
| 201 |
| 198 protected: | 202 protected: |
| 199 // Test that needs needs access to internal functions. | 203 // Test that needs needs access to internal functions. |
| 200 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExpireTest); | 204 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExpireTest); |
| 201 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExtractURLInQueryStringTest); | 205 FRIEND_TEST_ALL_PREFIXES(PrerenderManagerTest, ExtractURLInQueryStringTest); |
| 202 | 206 |
| 203 struct PendingContentsData; | 207 struct PendingContentsData; |
| 204 | 208 |
| 205 void SetPrerenderContentsFactory( | 209 void SetPrerenderContentsFactory( |
| 206 PrerenderContents::Factory* prerender_contents_factory); | 210 PrerenderContents::Factory* prerender_contents_factory); |
| 207 | 211 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 411 |
| 408 std::list<TabContentsWrapper*> old_tab_contents_list_; | 412 std::list<TabContentsWrapper*> old_tab_contents_list_; |
| 409 | 413 |
| 410 // Cancels pending tasks on deletion. | 414 // Cancels pending tasks on deletion. |
| 411 ScopedRunnableMethodFactory<PrerenderManager> runnable_method_factory_; | 415 ScopedRunnableMethodFactory<PrerenderManager> runnable_method_factory_; |
| 412 | 416 |
| 413 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; | 417 ScopedVector<OnCloseTabContentsDeleter> on_close_tab_contents_deleters_; |
| 414 | 418 |
| 415 scoped_ptr<PrerenderHistory> prerender_history_; | 419 scoped_ptr<PrerenderHistory> prerender_history_; |
| 416 | 420 |
| 421 std::list<const PrerenderCondition*> prerender_conditions_; |
| 422 |
| 417 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); | 423 DISALLOW_COPY_AND_ASSIGN(PrerenderManager); |
| 418 }; | 424 }; |
| 419 | 425 |
| 420 } // namespace prerender | 426 } // namespace prerender |
| 421 | 427 |
| 422 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ | 428 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_MANAGER_H_ |
| OLD | NEW |