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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 // Delay after which to initialize, to avoid putting to much load on the | 50 // Delay after which to initialize, to avoid putting to much load on the |
51 // database thread early on when Chrome is starting up. | 51 // database thread early on when Chrome is starting up. |
52 static const int kInitDelayMs = 5 * 1000; | 52 static const int kInitDelayMs = 5 * 1000; |
53 | 53 |
54 CancelableRequestConsumer history_db_consumer_; | 54 CancelableRequestConsumer history_db_consumer_; |
55 | 55 |
56 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_; | 56 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_; |
57 bool visit_history_initialized_; | 57 bool visit_history_initialized_; |
58 | 58 |
| 59 // We keep a reference to the HistoryService which we registered to |
| 60 // observe. On destruction, we have to remove ourselves from that history |
| 61 // service. We can't just grab the HistoryService from the profile, because |
| 62 // the profile may have already given up its reference to it. Doing nothing |
| 63 // in this case may cause crashes, because the HistoryService may outlive the |
| 64 // the PrerenderLocalPredictor. |
| 65 scoped_refptr<HistoryService> observing_history_service_; |
| 66 |
59 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); | 67 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor); |
60 }; | 68 }; |
61 | 69 |
62 } // namespace prerender | 70 } // namespace prerender |
63 | 71 |
64 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ | 72 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_ |
OLD | NEW |