Index: chrome/browser/chromeos/drive/event_logger.cc |
diff --git a/chrome/browser/chromeos/drive/event_logger.cc b/chrome/browser/chromeos/drive/event_logger.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1a42bd05f529828f7a7755a8471a3242d6f29a7f |
--- /dev/null |
+++ b/chrome/browser/chromeos/drive/event_logger.cc |
@@ -0,0 +1,29 @@ |
+// Copyright (c) 2012 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/chromeos/drive/event_logger.h" |
+ |
+namespace drive { |
+ |
+EventLogger::Event::Event(int id, const std::string& what) |
+ : id(id), |
+ when(base::Time::Now()), |
+ what(what) { |
+} |
+ |
+EventLogger::EventLogger(size_t history_size) |
+ : history_size_(history_size), |
+ next_event_id_(0) { |
+} |
+ |
+EventLogger::~EventLogger() { |
+} |
+ |
+void EventLogger::Log(const std::string& what) { |
+ history_.push_back(Event(next_event_id_++, what)); |
satorux1
2012/11/14 07:59:30
Let's increment this on the next line. post-increm
kinaba
2012/11/14 08:13:36
Done.
|
+ if (history_.size() > history_size_) |
+ history_.pop_front(); |
+} |
+ |
+} // namespace drive |