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

Unified Diff: chrome/browser/resources/file_manager/js/async_util.js

Issue 25278002: Extract ContentScanner from DirectoryContent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/resources/file_manager/js/async_util.js
diff --git a/chrome/browser/resources/file_manager/js/async_util.js b/chrome/browser/resources/file_manager/js/async_util.js
index 9b7639b5f40de0131bb58e8aeb9845b8165f7481..9a74bdbd8f915ce7fa2a1bc9f0097a2114b1582f 100644
--- a/chrome/browser/resources/file_manager/js/async_util.js
+++ b/chrome/browser/resources/file_manager/js/async_util.js
@@ -53,6 +53,13 @@ AsyncUtil.Queue = function() {
};
/**
+ * @return {boolean} True when a task is running, otherwise false.
+ */
+AsyncUtil.Queue.prototype.isRunning = function() {
+ return this.running_;
+};
+
+/**
* Enqueues a closure to be executed.
* @param {function(function())} closure Closure with a completion callback to
* be executed.
@@ -80,6 +87,14 @@ AsyncUtil.Queue.prototype.continue_ = function() {
};
/**
+ * Cancels all pending tasks. Note that this does NOT cancel the task running
+ * currently.
+ */
+AsyncUtil.Queue.prototype.cancel = function() {
mtomasz 2013/10/01 02:13:44 FYI: A more complete cancellation logic is planned
hidehiko 2013/10/01 04:12:23 Good to know. As we talked offline, please let me
+ this.closures_.splice(0, this.closures_.length);
mtomasz 2013/10/01 02:13:44 nit: How about just this.closures_ = []?
hidehiko 2013/10/01 04:12:23 Done.
+};
+
+/**
* Creates a class for executing several asynchronous closures in a group in
* a dependency order.
*

Powered by Google App Engine
This is Rietveld 408576698