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_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/scoped_observer.h" |
| 15 #include "base/task/cancelable_task_tracker.h" | 15 #include "base/task/cancelable_task_tracker.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "chrome/browser/history/visit_database.h" | 17 #include "chrome/browser/history/visit_database.h" |
| 18 #include "components/history/core/browser/history_service_observer.h" | 18 #include "components/history/core/browser/history_service_observer.h" |
| 19 #include "content/public/browser/session_storage_namespace.h" | |
| 20 #include "net/url_request/url_fetcher_delegate.h" | 19 #include "net/url_request/url_fetcher_delegate.h" |
| 21 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 22 | 21 |
| 23 class HistoryService; | 22 class HistoryService; |
| 24 | 23 |
| 25 namespace base { | 24 namespace base { |
| 26 class DictionaryValue; | 25 class DictionaryValue; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace content { | 28 namespace content { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NAMESPACE_NOT_ALIAS = 85, | 138 EVENT_NAMESPACE_MISMATCH_MERGE_RESULT_NAMESPACE_NOT_ALIAS = 85, |
| 140 EVENT_TAB_HELPER_URL_SEEN_MATCH_ENTRY = 86, | 139 EVENT_TAB_HELPER_URL_SEEN_MATCH_ENTRY = 86, |
| 141 EVENT_TAB_HELPER_URL_SEEN_MATCH_BROWSER_NAVIGATE = 87, | 140 EVENT_TAB_HELPER_URL_SEEN_MATCH_BROWSER_NAVIGATE = 87, |
| 142 EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_ENTRY = 88, | 141 EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_ENTRY = 88, |
| 143 EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_BROWSER_NAVIGATE = 89, | 142 EVENT_TAB_HELPER_URL_SEEN_NAMESPACE_MATCH_BROWSER_NAVIGATE = 89, |
| 144 EVENT_PREFETCH_LIST_ADDED = 90, | 143 EVENT_PREFETCH_LIST_ADDED = 90, |
| 145 EVENT_PREFETCH_LIST_SEEN_TABCONTENTS = 91, | 144 EVENT_PREFETCH_LIST_SEEN_TABCONTENTS = 91, |
| 146 EVENT_PREFETCH_LIST_SEEN_HISTORY = 92, | 145 EVENT_PREFETCH_LIST_SEEN_HISTORY = 92, |
| 147 EVENT_ISSUE_PRERENDER_CALLED = 93, | 146 EVENT_ISSUE_PRERENDER_CALLED = 93, |
| 148 EVENT_ISSUE_PRERENDER_PREFETCH_ENABLED = 94, | 147 EVENT_ISSUE_PRERENDER_PREFETCH_ENABLED = 94, |
| 149 EVENT_ISSUE_PRERENDER_PREFETCH_ISSUED = 95, | 148 EVENT_ISSUE_PRERENDER_PREFETCH_ISSUED = 95, |
|
mmenke
2014/12/12 16:04:48
I think some of these can be commented out as obso
davidben
2014/12/12 20:41:19
Done. I pruned all the unused ones. Hopefully we c
| |
| 150 EVENT_MAX_VALUE | 149 EVENT_MAX_VALUE |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 // A PrerenderLocalPredictor is owned by the PrerenderManager specified | 152 // A PrerenderLocalPredictor is owned by the PrerenderManager specified |
| 154 // in the constructor. It will be destoryed at the time its owning | 153 // in the constructor. It will be destoryed at the time its owning |
| 155 // PrerenderManager is destroyed. | 154 // PrerenderManager is destroyed. |
| 156 explicit PrerenderLocalPredictor(PrerenderManager* prerender_manager); | 155 explicit PrerenderLocalPredictor(PrerenderManager* prerender_manager); |
| 157 ~PrerenderLocalPredictor() override; | 156 ~PrerenderLocalPredictor() override; |
| 158 | 157 |
| 159 void Shutdown(); | 158 void Shutdown(); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 LocalPredictorURLInfo* url_info); | 201 LocalPredictorURLInfo* url_info); |
| 203 void MaybeCancelURLFetcher(net::URLFetcher* fetcher); | 202 void MaybeCancelURLFetcher(net::URLFetcher* fetcher); |
| 204 // Returns true if the parsed response is semantically correct and could | 203 // Returns true if the parsed response is semantically correct and could |
| 205 // be fully applied. | 204 // be fully applied. |
| 206 bool ApplyParsedPrerenderServiceResponse( | 205 bool ApplyParsedPrerenderServiceResponse( |
| 207 base::DictionaryValue* dict, | 206 base::DictionaryValue* dict, |
| 208 CandidatePrerenderInfo* info, | 207 CandidatePrerenderInfo* info, |
| 209 bool* hinting_timed_out, | 208 bool* hinting_timed_out, |
| 210 bool* hinting_url_lookup_timed_out, | 209 bool* hinting_url_lookup_timed_out, |
| 211 bool* candidate_url_lookup_timed_out); | 210 bool* candidate_url_lookup_timed_out); |
| 212 void ProcessNamespaceMergeResult( | |
| 213 content::SessionStorageNamespace::MergeResult result); | |
| 214 typedef std::map<net::URLFetcher*, CandidatePrerenderInfo*> | 211 typedef std::map<net::URLFetcher*, CandidatePrerenderInfo*> |
| 215 OutstandingFetchers; | 212 OutstandingFetchers; |
| 216 OutstandingFetchers outstanding_prerender_service_requests_; | 213 OutstandingFetchers outstanding_prerender_service_requests_; |
| 217 PrerenderManager* prerender_manager_; | 214 PrerenderManager* prerender_manager_; |
| 218 base::OneShotTimer<PrerenderLocalPredictor> timer_; | 215 base::OneShotTimer<PrerenderLocalPredictor> timer_; |
| 219 | 216 |
| 220 // Delay after which to initialize, to avoid putting to much load on the | 217 // Delay after which to initialize, to avoid putting to much load on the |
| 221 // database thread early on when Chrome is starting up. | 218 // database thread early on when Chrome is starting up. |
| 222 static const int kInitDelayMs = 5 * 1000; | 219 static const int kInitDelayMs = 5 * 1000; |
| 223 | 220 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 238 | 235 |
| 239 ScopedObserver<HistoryService, HistoryServiceObserver> | 236 ScopedObserver<HistoryService, HistoryServiceObserver> |
| 240 history_service_observer_; | 237 history_service_observer_; |
| 241 | 238 |
| 242 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); | 239 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); |
| 243 }; | 240 }; |
| 244 | 241 |
| 245 } // namespace prerender | 242 } // namespace prerender |
| 246 | 243 |
| 247 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ | 244 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ |
| OLD | NEW |