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

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

Issue 11365249: drive: Event logger for chrome:drive-internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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.h
diff --git a/chrome/browser/chromeos/drive/event_logger.h b/chrome/browser/chromeos/drive/event_logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..da0fea1f5b180d4db03722b509a53d7cff351bee
--- /dev/null
+++ b/chrome/browser/chromeos/drive/event_logger.h
@@ -0,0 +1,43 @@
+// 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.
+
+#ifndef CHROME_BROWSER_CHROMEOS_DRIVE_EVENT_LOGGER_H_
+#define CHROME_BROWSER_CHROMEOS_DRIVE_EVENT_LOGGER_H_
+
+#include <string>
+#include <deque>
+
+#include "base/basictypes.h"
+#include "base/time.h"
+
+namespace drive {
+
+class EventLogger {
satorux1 2012/11/14 05:55:11 Class comment is missing.
kinaba 2012/11/14 06:19:52 Done.
+ public:
+ struct Event {
+ explicit Event(const std::string& what);
+ base::Time when;
+ std::string what;
+ };
+
+ // Creates an event logger that keeps the latest |history_size| events.
+ explicit EventLogger(size_t history_size);
+ ~EventLogger();
+
+ // Logs a message.
+ void Log(const std::string& what);
+
+ // Gets the list of latest events (the oldest event comes first).
+ const std::deque<Event>& history() const { return history_; }
+
+ private:
+ std::deque<Event> history_;
+ const size_t history_size_;
+
+ DISALLOW_COPY_AND_ASSIGN(EventLogger);
+};
+
+} // namespace drive
+
+#endif // CHROME_BROWSER_CHROMEOS_DRIVE_EVENT_LOGGER_H_

Powered by Google App Engine
This is Rietveld 408576698