decord/source/modules/gateway/DispatcherWorkScheduler.native.tsx

70 lines
2.8 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13115
// Function ID: 13116
2026-07-29 08:29:29 +00:00
// Name: _queueIdleCallback
2026-08-25 06:04:03 +00:00
// Dependencies: [13114, 676, 13116, 709, 2]
2026-07-20 16:05:17 +00:00
// Exports: createDispatcherWorkScheduler
2026-08-25 06:04:03 +00:00
// Module 13115 (_queueIdleCallback)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import ME from "ME" /* 676 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-08-25 06:04:03 +00:00
import _trackAppBackgrounded from "_trackAppBackgrounded" /* 13116 */;
import DISPATCHER_STANDARD_TIMEOUT_MS from "DISPATCHER_STANDARD_TIMEOUT_MS" /* 13114 */;
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
({ DISPATCHER_CALLBACK_MAX_TIME_REMAINING_MS: obj1, NATIVE_WORK_BACKOFF_MS: c3, NATIVE_WORK_DEADLINE_MS: c4, WorkIdleDeadline: c5 } = DISPATCHER_STANDARD_TIMEOUT_MS);
2026-08-24 06:08:38 +00:00
const AppStates = ME.AppStates;
const BasicWorkScheduler = _trackAppBackgrounded.BasicWorkScheduler;
2026-07-29 08:29:29 +00:00
class DispatcherWorkScheduler extends BasicWorkScheduler {
constructor() {
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
2026-07-29 08:29:29 +00:00
tmp3 = new DispatcherWorkScheduler(tmp2, tmp, new.target, new.target, undefined);
// ThrowIfThisInitialized (0x7c)
2026-08-24 06:08:38 +00:00
closure_0 = tmp3;
2026-07-29 08:29:29 +00:00
obj = require("dispatcher");
subscription = obj.subscribe("APP_STATE_UPDATE", (arg0) => {
const result = obj._trackAppBackgrounded(tmp2 === tmp);
});
return tmp3;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = DispatcherWorkScheduler.prototype;
prototype["_queueIdleCallback"] = function _queueIdleCallback() {
let self = this;
self = this;
if (this._enableRequestIdleCallback) {
if (!self._criticalWorkScheduled) {
const _performance = performance;
2026-08-24 06:08:38 +00:00
closure_0 = performance.now();
2026-07-29 08:29:29 +00:00
const _setTimeout = setTimeout;
self._flushIdleHandler = setTimeout(() => {
({ _processWorkCallback, _consecutiveFlushesBeforeQueueEmpty } = self);
2026-08-24 06:08:38 +00:00
_processWorkCallback(new closure_1_5(Math.max(Math.max(0, closure_1_4 - (performance.now() - closure_0)) + closure_1_3 * _consecutiveFlushesBeforeQueueEmpty, closure_1_2), false));
2026-07-29 08:29:29 +00:00
}, 1);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return self._processWorkCallback();
};
prototype["_clearIdleCallback"] = function _clearIdleCallback() {
const self = this;
if (null != this._flushIdleHandler) {
const _clearTimeout = clearTimeout;
clearTimeout(self._flushIdleHandler);
self._flushIdleHandler = null;
}
};
2026-08-24 06:08:38 +00:00
let result = set.fileFinishedImporting("modules/gateway/DispatcherWorkScheduler.native.tsx");
2026-07-20 16:05:17 +00:00
export const createDispatcherWorkScheduler = function createDispatcherWorkScheduler() {
2026-08-04 21:03:28 +00:00
if (typeof DispatcherWorkScheduler !== "function") {
2026-07-29 08:29:29 +00:00
HermesBuiltin.throwTypeError();
}
2026-08-24 06:08:38 +00:00
importDefault = undefined;
2026-07-29 08:29:29 +00:00
const tmp3 = new DispatcherWorkScheduler("Trying to call a non-function", tmp, DispatcherWorkScheduler, new.target, undefined);
// ThrowIfThisInitialized (0x7c)
importDefault = tmp3;
2026-08-24 06:08:38 +00:00
const subscription = dispatcherDefault.subscribe("APP_STATE_UPDATE", (arg0) => {
2026-07-29 08:29:29 +00:00
const result = obj._trackAppBackgrounded(tmp2 === tmp);
});
return tmp3;
2026-07-20 16:05:17 +00:00
};