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

Unified Diff: chrome/browser/sync_file_system/task_logger.h

Issue 291403004: [SyncFS] Add TaskLogger and wire up it. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 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: chrome/browser/sync_file_system/task_logger.h
diff --git a/chrome/browser/sync_file_system/task_logger.h b/chrome/browser/sync_file_system/task_logger.h
new file mode 100644
index 0000000000000000000000000000000000000000..a6e5f0a9ea6c0a92209719a342e45e6160117780
--- /dev/null
+++ b/chrome/browser/sync_file_system/task_logger.h
@@ -0,0 +1,63 @@
+// Copyright 2014 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_SYNC_FILE_SYSTEM_TASK_LOGGER_H_
+#define CHROME_BROWSER_SYNC_FILE_SYSTEM_TASK_LOGGER_H_
+
+#include <deque>
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
+#include "base/time/time.h"
+
+namespace sync_file_system {
+
+class TaskLogger : public base::SupportsWeakPtr<TaskLogger> {
+ public:
+ struct TaskLog {
+ base::TimeDelta duration;
+ std::string type;
+ std::string summary;
+ std::vector<std::string> details;
+
+ TaskLog();
+ ~TaskLog();
+ };
+
+ class Observer {
+ public:
+ virtual void OnLogRecorded(const TaskLog& task_log) = 0;
+
+ protected:
+ Observer() {}
+ virtual ~Observer() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Observer);
+ };
+
+ TaskLogger();
+ ~TaskLogger();
+
+ void RecordLog(scoped_ptr<TaskLog> log);
+ void ClearLog();
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
+ const std::deque<TaskLog*>& GetLog() const;
+
+ private:
+ std::deque<TaskLog*> log_history_;
+
+ ObserverList<Observer> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(TaskLogger);
+};
+
+} // namespace sync_file_system
+
+#endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_TASK_LOGGER_H_
« no previous file with comments | « chrome/browser/sync_file_system/sync_file_system_service_factory.cc ('k') | chrome/browser/sync_file_system/task_logger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698