cleanup InteractionManager debugging a little

Summary: adding the flow types makes it impossible to forget to change them back.

Reviewed By: yungsters

Differential Revision: D14990037

fbshipit-source-id: d018e4cf6798d50bcfb44b55d3c68ca7f5beef72
This commit is contained in:
Spencer Ahrens 2019-04-23 16:00:44 -07:00 коммит произвёл Facebook Github Bot
Родитель 11439eabfc
Коммит c0efa1670a
2 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -23,8 +23,8 @@ import type {Task} from 'TaskQueue';
const _emitter = new EventEmitter();
const DEBUG_DELAY = 0;
const DEBUG = false;
const DEBUG_DELAY: 0 = 0;
const DEBUG: false = false;
/**
* InteractionManager allows long-running work to be scheduled after any
@ -121,7 +121,7 @@ const InteractionManager = {
* Notify manager that an interaction has started.
*/
createInteractionHandle(): Handle {
DEBUG && infoLog('create interaction handle');
DEBUG && infoLog('InteractionManager: create interaction handle');
_scheduleUpdate();
const handle = ++_inc;
_addInteractionSet.add(handle);
@ -132,8 +132,8 @@ const InteractionManager = {
* Notify manager that an interaction has completed.
*/
clearInteractionHandle(handle: Handle) {
DEBUG && infoLog('clear interaction handle');
invariant(!!handle, 'Must provide a handle to clear.');
DEBUG && infoLog('InteractionManager: clear interaction handle');
invariant(!!handle, 'InteractionManager: Must provide a handle to clear.');
_scheduleUpdate();
_addInteractionSet.delete(handle);
_deleteInteractionSet.add(handle);

Просмотреть файл

@ -23,7 +23,7 @@ type PromiseTask = {
};
export type Task = Function | SimpleTask | PromiseTask;
const DEBUG = false;
const DEBUG: false = false;
/**
* TaskQueue - A system for queueing and executing a mix of simple callbacks and
@ -100,10 +100,10 @@ class TaskQueue {
const task = queue.shift();
try {
if (task.gen) {
DEBUG && infoLog('genPromise for task ' + task.name);
DEBUG && infoLog('TaskQueue: genPromise for task ' + task.name);
this._genPromise((task: any)); // Rather than annoying tagged union
} else if (task.run) {
DEBUG && infoLog('run task ' + task.name);
DEBUG && infoLog('TaskQueue: run task ' + task.name);
task.run();
} else {
invariant(
@ -111,7 +111,7 @@ class TaskQueue {
'Expected Function, SimpleTask, or PromiseTask, but got:\n' +
JSON.stringify(task, null, 2),
);
DEBUG && infoLog('run anonymous task');
DEBUG && infoLog('TaskQueue: run anonymous task');
task();
}
} catch (e) {
@ -135,7 +135,7 @@ class TaskQueue {
) {
this._queueStack.pop();
DEBUG &&
infoLog('popped queue: ', {
infoLog('TaskQueue: popped queue: ', {
stackIdx,
queueStackSize: this._queueStack.length,
});
@ -152,13 +152,13 @@ class TaskQueue {
// happens once it is fully processed.
this._queueStack.push({tasks: [], popable: false});
const stackIdx = this._queueStack.length - 1;
DEBUG && infoLog('push new queue: ', {stackIdx});
DEBUG && infoLog('exec gen task ' + task.name);
DEBUG && infoLog('TaskQueue: push new queue: ', {stackIdx});
DEBUG && infoLog('TaskQueue: exec gen task ' + task.name);
task
.gen()
.then(() => {
DEBUG &&
infoLog('onThen for gen task ' + task.name, {
infoLog('TaskQueue: onThen for gen task ' + task.name, {
stackIdx,
queueStackSize: this._queueStack.length,
});