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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/visit_database.cc ('k') | chrome/browser/prerender/prerender_local_predictor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_local_predictor.h
===================================================================
--- chrome/browser/prerender/prerender_local_predictor.h (revision 0)
+++ chrome/browser/prerender/prerender_local_predictor.h (revision 0)
@@ -0,0 +1,64 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
+#define CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
+#pragma once
+
+#include <vector>
+
+#include "base/timer.h"
+#include "chrome/browser/cancelable_request.h"
+#include "chrome/browser/history/visit_database.h"
+#include "googleurl/src/gurl.h"
+
+class HistoryService;
+
+namespace prerender {
+
+class PrerenderManager;
+
+// PrerenderLocalPredictor maintains local browsing history to make prerender
+// predictions.
+// At this point, the class is just illustrating the interface with the
+// Chrome History.
+// TODO(tburkard): Fill in actual prerender prediction logic.
+class PrerenderLocalPredictor : history::VisitDatabaseObserver {
+ public:
+ // A PrerenderLocalPredictor is owned by the PrerenderManager specified
+ // in the constructor. It will be destoryed at the time its owning
+ // PrerenderManager is destroyed.
+ explicit PrerenderLocalPredictor(PrerenderManager* prerender_manager);
+ virtual ~PrerenderLocalPredictor();
+
+ // history::VisitDatabaseObserver implementation
+ virtual void OnAddVisit(const history::BriefVisitInfo& info) OVERRIDE;
+
+ void OnLookupURL(history::URLID url_id, const GURL& url);
+
+ void OnGetInitialVisitHistory(
+ scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history);
+
+ private:
+ HistoryService* GetHistoryIfExists() const;
+ void Init();
+
+ PrerenderManager* prerender_manager_;
+ base::OneShotTimer<PrerenderLocalPredictor> timer_;
+
+ // Delay after which to initialize, to avoid putting to much load on the
+ // database thread early on when Chrome is starting up.
+ static const int kInitDelayMs = 5 * 1000;
+
+ CancelableRequestConsumer history_db_consumer_;
+
+ scoped_ptr<std::vector<history::BriefVisitInfo> > visit_history_;
+ bool visit_history_initialized_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrerenderLocalPredictor);
+};
+
+} // namespace prerender
+
+#endif // CHROME_BROWSER_PRERENDER_PRERENDER_LOCAL_PREDICTOR_H_
Property changes on: chrome/browser/prerender/prerender_local_predictor.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/history/visit_database.cc ('k') | chrome/browser/prerender/prerender_local_predictor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698