Bug 1464461 - make dispatchMessagesAdd use batching; r=nchevobbe
MozReview-Commit-ID: 7sCFIfC2ovi
--- a/devtools/client/webconsole/webconsole-output-wrapper.js
+++ b/devtools/client/webconsole/webconsole-output-wrapper.js
@@ -256,22 +256,22 @@ WebConsoleOutputWrapper.prototype = {
}
}
}.bind(this));
});
} else {
promise = Promise.resolve();
}
- this.batchedMessagesAdd(packet);
+ this.batchedMessageAdd(packet);
return promise;
},
dispatchMessagesAdd: function(messages) {
- store.dispatch(actions.messagesAdd(messages));
+ this.batchedMessagesAdd(messages);
},
dispatchMessagesClear: function() {
// We might still have pending message additions and updates when the clear action is
// triggered, so we need to flush them to make sure we don't have unexpected behavior
// in the ConsoleOutput.
this.queuedMessageAdds = [];
this.queuedMessageUpdates = [];
@@ -368,21 +368,26 @@ WebConsoleOutputWrapper.prototype = {
this.setTimeoutIfNeeded();
},
batchedRequestUpdates: function(message) {
this.queuedRequestUpdates.push(message);
this.setTimeoutIfNeeded();
},
- batchedMessagesAdd: function(message) {
+ batchedMessageAdd: function(message) {
this.queuedMessageAdds.push(message);
this.setTimeoutIfNeeded();
},
+ batchedMessagesAdd: function(messages) {
+ this.queuedMessageAdds = this.queuedMessageAdds.concat(messages);
+ this.setTimeoutIfNeeded();
+ },
+
dispatchClearHistory: function() {
store.dispatch(actions.clearHistory());
},
/**
* Returns a Promise that resolves once any async dispatch is finally dispatched.
*/
waitAsyncDispatches: function() {