Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/browser/prerender/prerender_local_predictor.h

Issue 10067018: Add PrerenderLocalPredictor, which will eventually perform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
7 #pragma once
8
9 #include <vector>
10
11 #include "base/timer.h"
12 #include "chrome/browser/cancelable_request.h"
13 #include "chrome/browser/history/visit_database.h"
14 #include "googleurl/src/gurl.h"
15
16 class HistoryService;
17
18 namespace prerender {
19
20 class PrerenderManager;
21
22 // PrerenderLocalPredictor maintains local browsing history to make prerender
23 // predictions.
24 // At this point, the class is just illustrating the interface with the
25 // Chrome History.
26 // TODO(tburkard): Fill in actual prerender prediction logic.
27 class PrerenderLocalPredictor : history::VisitDatabaseObserver {
28 public:
29 explicit PrerenderLocalPredictor(PrerenderManager* prerender_manager);
cbentzel 2012/04/23 20:29:47 Perhaps it's implied due to raw pointer - but you
tburkard 2012/04/23 20:54:55 Done.
30 virtual ~PrerenderLocalPredictor();
31
32 // history::VisitDatabaseObserver implementation
33 virtual void OnAddVisit(const history::BriefVisitInfo& info) OVERRIDE;
34
35 void OnLookupURL(history::URLID url_id, const GURL& url);
36
37 void OnGetInitialVisitHistory(
38 std::vector<history::BriefVisitInfo>* visit_history);
39
40 private:
41 HistoryService* GetHistoryIfExists() const;
42 void Init();
43
44 PrerenderManager* prerender_manager_;
45 base::OneShotTimer<PrerenderLocalPredictor> timer_;
46
47 // Delay after which to initialize, to avoid putting to much load on the
48 // database thread early on when Chrome is starting up.
49 static const int kInitDelayMs = 5 * 1000;
cbentzel 2012/04/23 20:29:47 Nit: I like moving these into the anonymous namesp
tburkard 2012/04/23 20:54:55 Done.
50 // Maximum visit history to retrieve from the visit database.
51 static const int kMaxVisitHistory = 100 * 1000;
52
53 CancelableRequestConsumer history_db_consumer_;
54
55 scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_;
56 bool visit_history_initialized_;
57
58 DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor);
59 };
60
61 } // namespace prerender
62
63 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698