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

Unified Diff: chrome/browser/policy/logging_work_scheduler.cc

Issue 7264019: Readability review for gfeher (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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
« no previous file with comments | « chrome/browser/policy/logging_work_scheduler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/logging_work_scheduler.cc
diff --git a/chrome/browser/policy/logging_work_scheduler.cc b/chrome/browser/policy/logging_work_scheduler.cc
index a5181bb7da52ed60be14942ce920cf84c8305a0b..f83c4c94f70d5d0b6c492119c7dac446bbc4dfa8 100644
--- a/chrome/browser/policy/logging_work_scheduler.cc
+++ b/chrome/browser/policy/logging_work_scheduler.cc
@@ -11,6 +11,39 @@
namespace policy {
+// Objects of this class are used in the priority-queue of future tasks
+// in EventLogger.
+class EventLogger::Task {
+ public:
+ Task();
+ Task(int64 trigger_time,
+ int64 secondary_key,
+ linked_ptr<base::Closure> callback);
+ ~Task();
+
+ // Returns true if |this| should be executed before |rhs|.
+ // Used for sorting by the priority queue.
+ bool operator< (const Task& rhs) const;
+
+ int64 trigger_time() const;
+
+ // Returns a copy of the callback object of this task, and resets the
+ // original callback object. (LoggingTaskScheduler owns a linked_ptr to
+ // its task's callback objects and it only allows firing new tasks if the
+ // previous task's callback object has been reset.)
+ base::Closure GetAndResetCallback();
+
+ private:
+ // The virtual time when this task will trigger.
+ // Smaller times win.
+ int64 trigger_time_;
+ // Used for sorting tasks that have the same trigger_time.
+ // Bigger keys win.
+ int64 secondary_key_;
+
+ linked_ptr<base::Closure> callback_;
+};
+
EventLogger::Task::Task() {
}
« no previous file with comments | « chrome/browser/policy/logging_work_scheduler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698