[invalidations] Added list of registered handlers to about:invalidations
This patch is a follow-up to issue 147353011 (SVN Rev 250458)
This patch adds the list of every InvalidationHandler registered in the
active InvalidationService. This was needed because potentially an
InvalidationHandler can be registered for invalidations but have no
ObjectsId registered yet, so they wouldn't appear on neither the table
nor the event log. This patch allows listing those handlers.
BUG=263863
Review URL: https://codereview.chromium.org/166903013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253677 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/resources/about_invalidations.js b/chrome/browser/resources/about_invalidations.js
index f6982ca..65c406c 100644
--- a/chrome/browser/resources/about_invalidations.js
+++ b/chrome/browser/resources/about_invalidations.js
@@ -20,7 +20,6 @@
/**
* Appends a string to a textarea log.
- *
* @param {string} logMessage The string to be appended.
*/
function appendToLog(logMessage) {
@@ -44,7 +43,6 @@
/**
* Shows the current state of the InvalidatorService
- *
* @param {string} newState The string to be displayed and logged.
*/
function updateState(newState) {
@@ -58,8 +56,7 @@
/**
* Adds to the log the latest invalidations received
- *
- * @param {Array of Object} allInvalidations The array of ObjectId
+ * @param {!Array.<!Object>} allInvalidations The array of ObjectId
* that contains the invalidations received by the InvalidatorService.
*/
function logInvalidations(allInvalidations) {
@@ -85,9 +82,8 @@
/**
* Marks a change in the table whether a new invalidation has arrived
* or a new ObjectId is currently being added or updated.
- *
- * @param {object} oId The ObjectId being added or updated.
- * @param {bool} isInvaldation A flag that says that an invalidation
+ * @param {!Object} oId The ObjectId being added or updated.
+ * @param {!boolean} isInvaldation A flag that says that an invalidation
* for this ObjectId has arrived or we just need to add it to the table
* as it was just updated its state.
*/
@@ -126,8 +122,22 @@
}
/**
+ * Shows the handlers that are currently registered for invalidations
+ * (but might not have objects ids registered yet).
+ * @param {!Array.<string>} allHandlers An array of Strings that are
+ * the names of all the handlers currently registered in the
+ * InvalidatorService.
+ */
+ function updateHandlers(allHandlers) {
+ var allHandlersFormatted = allHandlers.join(', ');
+ $('registered-handlers').textContent = allHandlersFormatted;
+ var logMessage = nowTimeString() +
+ 'InvalidatorHandlers currently registered: ' + allHandlersFormatted;
+ appendToLog(logMessage);
+ }
+
+ /**
* Updates the table with the objects ids registered for invalidations
- *
* @param {string} registrar The name of the owner of the InvalidationHandler
* that is registered for invalidations
* @param {Array of Object} allIds An array of ObjectsIds that are currently
@@ -160,10 +170,11 @@
}
return {
- updateState: updateState,
- updateIds: updateIds,
logInvalidations: logInvalidations,
- onLoadWork: onLoadWork
+ onLoadWork: onLoadWork,
+ updateHandlers: updateHandlers,
+ updateIds: updateIds,
+ updateState: updateState,
};
});