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

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

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_log.h ('k') | chrome/browser/history/visit_log_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/visit_log.cc
===================================================================
--- chrome/browser/history/visit_log.cc (revision 0)
+++ chrome/browser/history/visit_log.cc (revision 0)
@@ -0,0 +1,56 @@
+// 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.
+
+#include "chrome/browser/history/visit_log.h"
+
+namespace history {
+
+static VisitLog* g_visit_log = NULL;
+
+VisitLog::VisitLog()
+ : index_(0),
+ num_add_(0),
+ num_delete_(0),
+ num_update_(0),
+ num_select_(0) {
+ memset(events_, NO_OP, sizeof(events_));
+}
+
+VisitLog::~VisitLog() {
+}
+
+void VisitLog::AddEvent(EventType event) {
+ switch (event) {
+ case ADD_VISIT:
+ num_add_++;
+ break;
+ case DELETE_VISIT:
+ num_delete_++;
+ break;
+ case UPDATE_VISIT:
+ num_update_++;
+ break;
+ case SELECT_VISIT:
+ num_select_++;
+ break;
+ default:
+ return;
+ }
+
+ events_[index_++] = event;
+ if (index_ == kVisitLogBufferSize)
+ index_ = 0;
+}
+
+void InitVisitLog(VisitLog* vlog) {
+ g_visit_log = vlog;
+}
+
+void AddEventToVisitLog(VisitLog::EventType event) {
+ if (!g_visit_log)
+ return;
+ g_visit_log->AddEvent(event);
+}
+
+} // namespace history
« no previous file with comments | « chrome/browser/history/visit_log.h ('k') | chrome/browser/history/visit_log_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698