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

Unified Diff: components/offline_pages/offline_event_logger.h

Issue 2089413002: [Offline Pages] Create a event/activity logger (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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: components/offline_pages/offline_event_logger.h
diff --git a/components/offline_pages/offline_event_logger.h b/components/offline_pages/offline_event_logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..c12e9b6dd0366629a9686da42fa5a9e063c661b6
--- /dev/null
+++ b/components/offline_pages/offline_event_logger.h
@@ -0,0 +1,44 @@
+// Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_OFFLINE_EVENT_LOGGER_H_
+#define COMPONENTS_OFFLINE_PAGES_OFFLINE_EVENT_LOGGER_H_
+
+#include <deque>
+#include <string>
+#include <vector>
+
+#include "base/macros.h"
+
+namespace offline_pages {
+
+class OfflineEventLogger {
Pete Williamson 2016/06/24 00:38:32 A class header comment with usage notes would be n
chili 2016/06/24 02:45:51 Done.
+ public:
+ OfflineEventLogger();
+
+ ~OfflineEventLogger();
+
+ // Clears the recorded activities.
+ void Clear();
+
+ // Turns logging on/off.
+ void SetIsLogging(bool is_logging);
+
+ // Dumps the current activity list into |records|.
+ void GetLogs(std::vector<std::string>& records);
+
+ protected:
+ // Write the activity into the cycling log if we are currently logging.
+ void RecordActivity(const std::string& activity);
+
+ private:
+ // Recorded offline page activities.
+ std::deque<std::string> activities_;
Pete Williamson 2016/06/24 00:38:32 I like your choice of a deque here, it fits perfec
chili 2016/06/24 02:45:51 Acknowledged. ^_^
+
+ // Whether we are currently recording logs or not.
+ bool is_logging_;
+};
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_EVENT_LOGGER_H_

Powered by Google App Engine
This is Rietveld 408576698