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

Unified Diff: chrome/common/cancelable_task_tracker.h

Issue 11414041: Add function to CancelableTaskTracker and convert BootTimeLoader (take 2) (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
« no previous file with comments | « chrome/browser/chromeos/login/version_info_updater.cc ('k') | chrome/common/cancelable_task_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/cancelable_task_tracker.h
diff --git a/chrome/common/cancelable_task_tracker.h b/chrome/common/cancelable_task_tracker.h
index 0a7289b03d5e25729785b11f70605ce4c177cee8..86450c30c486648bf9cd2d72a618521bf6c4c3f2 100644
--- a/chrome/common/cancelable_task_tracker.h
+++ b/chrome/common/cancelable_task_tracker.h
@@ -28,6 +28,8 @@
// commonly used to cancel all outstanding tasks.
//
// 2. Both task and reply are deleted on the originating thread.
+//
+// 3. IsCanceledCallback is thread safe and can be run or deleted on any thread.
#ifndef CHROME_COMMON_CANCELABLE_TASK_TRACKER_H_
#define CHROME_COMMON_CANCELABLE_TASK_TRACKER_H_
@@ -53,6 +55,8 @@ class CancelableTaskTracker {
typedef int64 TaskId;
static const TaskId kBadTaskId;
+ typedef base::Callback<bool()> IsCanceledCallback;
+
CancelableTaskTracker();
// Cancels all tracked tasks.
@@ -67,6 +71,14 @@ class CancelableTaskTracker {
const base::Closure& task,
const base::Closure& reply);
+ // Creates a tracked TaskId and an associated IsCanceledCallback. Client can
+ // later call TryCancel() with the returned TaskId, and run |is_canceled_cb|
+ // to check whether the TaskId is canceled.
+ //
+ // Note. This function is used to address some special cancelation requirement
+ // in existing code. You SHOULD NOT need this function in new code.
+ TaskId NewTrackedTaskId(IsCanceledCallback* is_canceled_cb);
+
// After calling this function, |task| and |reply| will not run. If the
// cancelation happens when |task| is running or has finished running, |reply|
// will not run. If |reply| is running or has finished running, cancellation
« no previous file with comments | « chrome/browser/chromeos/login/version_info_updater.cc ('k') | chrome/common/cancelable_task_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698