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

Unified Diff: Source/devtools/front_end/common/utilities.js

Issue 438333003: DevTools: use setImmediate instead of setTimeout for dispatching messages on devtools frontend in d… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed tests Created 6 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 | « no previous file | Source/devtools/front_end/externs.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/common/utilities.js
diff --git a/Source/devtools/front_end/common/utilities.js b/Source/devtools/front_end/common/utilities.js
index 85d5338e882fb3b6ae2962efab8a737808fa63bd..15af0cc7a6e335659517642ac8e5405ed27529d5 100644
--- a/Source/devtools/front_end/common/utilities.js
+++ b/Source/devtools/front_end/common/utilities.js
@@ -1747,3 +1747,19 @@ WeakReference.prototype = {
}
};
+/**
+ * @param {function()} callback
+ */
+self.setImmediate = (function() {
pfeldman 2014/09/26 09:42:20 @vsevik, @dgozman: do you want to count the number
+ var callbacks = [];
+ function run() {
+ var cbList = callbacks.slice();
+ callbacks.length = 0;
+ cbList.forEach(function(callback) { callback(); });
+ };
+ return function setImmediate(callback) {
+ if (!callbacks.length)
+ new Promise(function(resolve,reject){ resolve(null);}).then(run);
pfeldman 2014/09/26 09:42:20 self.setImmediate = function(callback) { Promi
+ callbacks.push(callback);
+ };
+})();
« no previous file with comments | « no previous file | Source/devtools/front_end/externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698