OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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_CHROMEOS_DRIVE_EVENT_LOGGER_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_EVENT_LOGGER_H_ | |
7 | |
8 #include <string> | |
9 #include <deque> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/time.h" | |
13 | |
14 namespace drive { | |
15 | |
16 class EventLogger { | |
satorux1
2012/11/14 05:55:11
Class comment is missing.
kinaba
2012/11/14 06:19:52
Done.
| |
17 public: | |
18 struct Event { | |
19 explicit Event(const std::string& what); | |
20 base::Time when; | |
21 std::string what; | |
22 }; | |
23 | |
24 // Creates an event logger that keeps the latest |history_size| events. | |
25 explicit EventLogger(size_t history_size); | |
26 ~EventLogger(); | |
27 | |
28 // Logs a message. | |
29 void Log(const std::string& what); | |
30 | |
31 // Gets the list of latest events (the oldest event comes first). | |
32 const std::deque<Event>& history() const { return history_; } | |
33 | |
34 private: | |
35 std::deque<Event> history_; | |
36 const size_t history_size_; | |
37 | |
38 DISALLOW_COPY_AND_ASSIGN(EventLogger); | |
39 }; | |
40 | |
41 } // namespace drive | |
42 | |
43 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_EVENT_LOGGER_H_ | |
OLD | NEW |