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

Unified Diff: chrome/browser/resources/google_now/utility.js

Issue 158003003: Convert Google Now's State Change Gathering Mechanism to use Promises (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Change from .apply to .call Created 6 years, 10 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/resources/google_now/common_test_util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/google_now/utility.js
diff --git a/chrome/browser/resources/google_now/utility.js b/chrome/browser/resources/google_now/utility.js
index 904da6b9cd885dd642262a30d114b1cb604b73e7..aa20066306585f1ed6b2194fd1716085e9f063eb 100644
--- a/chrome/browser/resources/google_now/utility.js
+++ b/chrome/browser/resources/google_now/utility.js
@@ -437,6 +437,17 @@ wrapper.instrumentChromeApiFunction('identity.removeCachedAuthToken', 1);
wrapper.instrumentChromeApiFunction('webstorePrivate.getBrowserLogin', 0);
/**
+ * Add task tracking support to Promises.
+ * @override
+ */
+Promise.prototype.then = function() {
+ var originalThen = Promise.prototype.then;
+ return function(callback) {
+ originalThen.call(this, wrapper.wrapCallback(callback, false));
+ }
+}();
+
+/**
* Builds the object to manage tasks (mutually exclusive chains of events).
* @param {function(string, string): boolean} areConflicting Function that
* checks if a new task can't be added to a task queue that contains an
« no previous file with comments | « chrome/browser/resources/google_now/common_test_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698