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

Unified Diff: chrome/browser/chromeos/drive/event_logger.cc

Issue 11365249: drive: Event logger for chrome:drive-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix (#5) Created 8 years, 1 month 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
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..446aed976bc111e3bd28f6a710a1d9d99e99713f
--- /dev/null
+++ b/chrome/browser/chromeos/drive/event_logger.cc
@@ -0,0 +1,30 @@
+// 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));
+ ++next_event_id_;
+ if (history_.size() > history_size_)
+ history_.pop_front();
+}
+
+} // namespace drive
« no previous file with comments | « chrome/browser/chromeos/drive/event_logger.h ('k') | chrome/browser/resources/chromeos/drive_internals.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698