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 172 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 |