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

Unified Diff: chrome/browser/history/visit_log.h

Issue 187004: Adding in memory log of history visit database. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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/history/visit_log.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/visit_log.h
===================================================================
--- chrome/browser/history/visit_log.h (revision 0)
+++ chrome/browser/history/visit_log.h (revision 0)
@@ -0,0 +1,61 @@
+// Copyright (c) 2009 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_HISTORY_VISIT_LOG_H_
+#define CHROME_BROWSER_HISTORY_VISIT_LOG_H_
+
+#include "base/basictypes.h"
+
+namespace history {
+
+// VisitLog provides support for basic in-memory logging of history visit
+// events. It keeps a circular buffer where the recent visit events is
+// recorded.
+
+// This class is not thread safe.
+class VisitLog {
+ public:
+ VisitLog();
+ ~VisitLog();
+
+ enum EventType {
+ NO_OP,
+ ADD_VISIT,
+ DELETE_VISIT,
+ UPDATE_VISIT,
+ SELECT_VISIT,
+ };
+
+ static int events_buffer_size() { return kVisitLogBufferSize; }
+ unsigned char* events() { return events_; }
+ int index() { return index_; }
+
+ int num_add() { return num_add_; }
+ int num_delete() { return num_delete_; }
+ int num_update() { return num_update_; }
+ int num_select() { return num_select_; }
+
+ void AddEvent(EventType event);
+
+ private:
+ // Circular buffer of recent events.
+ static const int kVisitLogBufferSize = 4096;
+ unsigned char events_[kVisitLogBufferSize];
+ int index_;
+
+ // Event counters
+ int num_add_;
+ int num_delete_;
+ int num_update_;
+ int num_select_;
+
+ DISALLOW_COPY_AND_ASSIGN(VisitLog);
+};
+
+void InitVisitLog(VisitLog* vlog);
+void AddEventToVisitLog(VisitLog::EventType event);
+
+} // namespace history
+
+#endif // CHROME_BROWSER_HISTORY_VISIT_LOG_H_
« no previous file with comments | « chrome/browser/history/visit_database.cc ('k') | chrome/browser/history/visit_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698