Only call callImmediates once per batch
Reviewed By: AaaChiuuu Differential Revision: D5163897 fbshipit-source-id: bcff70c4a6a6329b9ae771d9cad14876e3a40250
This commit is contained in:
parent
c57d7eaf43
commit
07ee2fb90a
|
@ -99,7 +99,6 @@ class MessageQueue {
|
|||
callFunctionReturnFlushedQueue(module: string, method: string, args: Array<any>) {
|
||||
this.__guard(() => {
|
||||
this.__callFunction(module, method, args);
|
||||
this.__callImmediates();
|
||||
});
|
||||
|
||||
return this.flushedQueue();
|
||||
|
@ -109,7 +108,6 @@ class MessageQueue {
|
|||
let result;
|
||||
this.__guard(() => {
|
||||
result = this.__callFunction(module, method, args);
|
||||
this.__callImmediates();
|
||||
});
|
||||
|
||||
return [result, this.flushedQueue()];
|
||||
|
@ -118,14 +116,15 @@ class MessageQueue {
|
|||
invokeCallbackAndReturnFlushedQueue(cbID: number, args: Array<any>) {
|
||||
this.__guard(() => {
|
||||
this.__invokeCallback(cbID, args);
|
||||
this.__callImmediates();
|
||||
});
|
||||
|
||||
return this.flushedQueue();
|
||||
}
|
||||
|
||||
flushedQueue() {
|
||||
this.__callImmediates();
|
||||
this.__guard(() => {
|
||||
this.__callImmediates();
|
||||
});
|
||||
|
||||
const queue = this._queue;
|
||||
this._queue = [[], [], [], this._callID];
|
||||
|
@ -220,7 +219,7 @@ class MessageQueue {
|
|||
|
||||
__callImmediates() {
|
||||
Systrace.beginEvent('JSTimersExecution.callImmediates()');
|
||||
this.__guard(() => JSTimersExecution.callImmediates());
|
||||
JSTimersExecution.callImmediates();
|
||||
Systrace.endEvent();
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,9 @@ const JSTimersExecution = {
|
|||
* more immediates are queued up (can be used as a condition a while loop).
|
||||
*/
|
||||
callImmediatesPass() {
|
||||
Systrace.beginEvent('JSTimersExecution.callImmediatesPass()');
|
||||
if (__DEV__) {
|
||||
Systrace.beginEvent('JSTimersExecution.callImmediatesPass()');
|
||||
}
|
||||
|
||||
// The main reason to extract a single pass is so that we can track
|
||||
// in the system trace
|
||||
|
@ -202,8 +204,9 @@ const JSTimersExecution = {
|
|||
}
|
||||
}
|
||||
|
||||
Systrace.endEvent();
|
||||
|
||||
if (__DEV__) {
|
||||
Systrace.endEvent();
|
||||
}
|
||||
return JSTimersExecution.immediates.length > 0;
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue