| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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_HISTORY_VISIT_LOG_H_ |
| 6 #define CHROME_BROWSER_HISTORY_VISIT_LOG_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 |
| 10 namespace history { |
| 11 |
| 12 // VisitLog provides support for basic in-memory logging of history visit |
| 13 // events. It keeps a circular buffer where the recent visit events is |
| 14 // recorded. |
| 15 |
| 16 // This class is not thread safe. |
| 17 class VisitLog { |
| 18 public: |
| 19 VisitLog(); |
| 20 ~VisitLog(); |
| 21 |
| 22 enum EventType { |
| 23 NO_OP, |
| 24 ADD_VISIT, |
| 25 DELETE_VISIT, |
| 26 UPDATE_VISIT, |
| 27 SELECT_VISIT, |
| 28 }; |
| 29 |
| 30 static int events_buffer_size() { return kVisitLogBufferSize; } |
| 31 unsigned char* events() { return events_; } |
| 32 int index() { return index_; } |
| 33 |
| 34 int num_add() { return num_add_; } |
| 35 int num_delete() { return num_delete_; } |
| 36 int num_update() { return num_update_; } |
| 37 int num_select() { return num_select_; } |
| 38 |
| 39 void AddEvent(EventType event); |
| 40 |
| 41 private: |
| 42 // Circular buffer of recent events. |
| 43 static const int kVisitLogBufferSize = 4096; |
| 44 unsigned char events_[kVisitLogBufferSize]; |
| 45 int index_; |
| 46 |
| 47 // Event counters |
| 48 int num_add_; |
| 49 int num_delete_; |
| 50 int num_update_; |
| 51 int num_select_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(VisitLog); |
| 54 }; |
| 55 |
| 56 void InitVisitLog(VisitLog* vlog); |
| 57 void AddEventToVisitLog(VisitLog::EventType event); |
| 58 |
| 59 } // namespace history |
| 60 |
| 61 #endif // CHROME_BROWSER_HISTORY_VISIT_LOG_H_ |
| OLD | NEW |