blob: 31c4976830ee52fdad0351cf64ec1e9e53638749 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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_
|