| 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_LOCAL_PREDICTOR_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
| 12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/scoped_observer.h" |
| 14 #include "base/task/cancelable_task_tracker.h" | 15 #include "base/task/cancelable_task_tracker.h" |
| 15 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 16 #include "chrome/browser/history/visit_database.h" | 17 #include "chrome/browser/history/visit_database.h" |
| 17 #include "components/history/core/browser/history_service_observer.h" | 18 #include "components/history/core/browser/history_service_observer.h" |
| 18 #include "content/public/browser/session_storage_namespace.h" | 19 #include "content/public/browser/session_storage_namespace.h" |
| 19 #include "net/url_request/url_fetcher_delegate.h" | 20 #include "net/url_request/url_fetcher_delegate.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 class HistoryService; | 23 class HistoryService; |
| 23 | 24 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 typedef std::map<net::URLFetcher*, CandidatePrerenderInfo*> | 214 typedef std::map<net::URLFetcher*, CandidatePrerenderInfo*> |
| 214 OutstandingFetchers; | 215 OutstandingFetchers; |
| 215 OutstandingFetchers outstanding_prerender_service_requests_; | 216 OutstandingFetchers outstanding_prerender_service_requests_; |
| 216 PrerenderManager* prerender_manager_; | 217 PrerenderManager* prerender_manager_; |
| 217 base::OneShotTimer<PrerenderLocalPredictor> timer_; | 218 base::OneShotTimer<PrerenderLocalPredictor> timer_; |
| 218 | 219 |
| 219 // Delay after which to initialize, to avoid putting to much load on the | 220 // Delay after which to initialize, to avoid putting to much load on the |
| 220 // database thread early on when Chrome is starting up. | 221 // database thread early on when Chrome is starting up. |
| 221 static const int kInitDelayMs = 5 * 1000; | 222 static const int kInitDelayMs = 5 * 1000; |
| 222 | 223 |
| 223 // Whether we're registered with the history service as a | |
| 224 // history::HistoryServiceObserver. | |
| 225 bool is_history_service_observer_; | |
| 226 | |
| 227 base::CancelableTaskTracker history_db_tracker_; | 224 base::CancelableTaskTracker history_db_tracker_; |
| 228 | 225 |
| 229 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_; | 226 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_; |
| 230 | 227 |
| 231 scoped_ptr<PrerenderProperties> current_prerender_; | 228 scoped_ptr<PrerenderProperties> current_prerender_; |
| 232 scoped_ptr<PrerenderProperties> last_swapped_in_prerender_; | 229 scoped_ptr<PrerenderProperties> last_swapped_in_prerender_; |
| 233 | 230 |
| 234 ScopedVector<PrerenderProperties> issued_prerenders_; | 231 ScopedVector<PrerenderProperties> issued_prerenders_; |
| 235 | 232 |
| 236 base::hash_set<int64> url_whitelist_; | 233 base::hash_set<int64> url_whitelist_; |
| 237 | 234 |
| 238 base::WeakPtrFactory<PrerenderLocalPredictor> weak_factory_; | 235 base::WeakPtrFactory<PrerenderLocalPredictor> weak_factory_; |
| 239 | 236 |
| 240 scoped_ptr<PrefetchList> prefetch_list_; | 237 scoped_ptr<PrefetchList> prefetch_list_; |
| 241 | 238 |
| 239 ScopedObserver<HistoryService, HistoryServiceObserver> |
| 240 history_service_observer_; |
| 241 |
| 242 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); | 242 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 } // namespace prerender | 245 } // namespace prerender |
| 246 | 246 |
| 247 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ | 247 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ |
| OLD | NEW |