Files
discord-decomp/sources/utils/ProcessUtils.native.tsx
T
2026-07-27 16:20:00 +03:00

394 lines
14 KiB
TypeScript

/* Metro module 5256; source: utils/ProcessUtils.native.tsx; dependencies: [6, 7, 15, 17, 18, 27, 5257, 2] */
function _fun46719(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#46719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:6, offset: 0x011adbaf, size: 251 bytes, params: 8, frame: 19
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_0 = importDefault(6) /* metro dependency 6 */;
const env0_1 = importDefault(7) /* metro dependency 7 */;
const env0_2 = importDefault(15) /* metro dependency 15 */;
const env0_3 = importDefault(17) /* metro dependency 17 */;
const env0_4 = importDefault(18) /* metro dependency 18 */;
const env0_5 = (require(27) /* metro dependency 27 */).NativeModules;
const ProcessUtils = (require(5257) /* metro dependency 5257: ProcessUtilsBase */).ProcessUtils;
let value = _fun46726(ProcessUtils);
value = new value();
(require(2) /* metro dependency 2 */).fileFinishedImporting('utils/ProcessUtils.native.tsx');
exports.default = value;
}
function _isNativeReflectConstruct_46720() { // fn#46720, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:172, offset: 0x011adcaa, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_46720_isNativeReflectConstruct = function() {
return !!result;
})();
}
function getHermesInstrumentedStatsSummary() { // fn#46723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:365, offset: 0x011add08, size: 192 bytes, params: 1, frame: 19
var r1;
var instrumentedStats;
var value3;
var value4;
var Object;
var entries;
var value5;
var filter;
var closure;
var value6;
var slice;
var value7;
var map;
var value8;
var length;
var value9;
var join;
var value10;
var error;
let value = undefined;
const HermesInternal = global.globalThis.HermesInternal;
if (HermesInternal == null) {
return value;
}
if (typeof HermesInternal !== 'object') {
return value;
}
const getInstrumentedStats = HermesInternal.getInstrumentedStats;
if (typeof getInstrumentedStats !== 'function') {
return value;
}
try {
instrumentedStats = getInstrumentedStats();
} catch (error) {
return value;
}
try {
value3 = instrumentedStats == null;
} catch (error) {
return value;
}
if (value3) {
return value;
}
try {
value4 = typeof instrumentedStats !== 'object';
} catch (error) {
return value;
}
if (value4) {
return value;
}
try {
Object = global.Object;
} catch (error) {
return value;
}
try {
entries = Object.entries;
} catch (error) {
return value;
}
try {
value5 = Reflect.apply(entries, Object, [instrumentedStats]);
} catch (error) {
return value;
}
try {
filter = value5.filter;
} catch (error) {
return value;
}
try {
closure = function(a0) {
var r1;
var r2;
var r3;
var item3;
var value3;
var iterator = a0[Symbol.iterator]();
var iterator2 = iterator.next;
var value = undefined;
var item2 = Reflect.apply(iterator2, iterator, []);
var item = item2.value;
item2 = item2.done ? undefined : iterator;
var value2 = item2 === value;
if (value2) {
}
if (value2) {
r1 = item2;
r2 = value2;
r3 = value;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r1 = item3;
r2 = value3;
r3 = value;
} else {
r1 = item3;
r2 = value3;
r3 = item;
}
}
if (!r2) {
r1.return();
}
r3 = typeof r3 === 'number' && global.Number.isFinite(r3);
return r3;
};
} catch (error) {
return value;
}
try {
value6 = Reflect.apply(filter, value5, [closure]);
} catch (error) {
return value;
}
try {
slice = value6.slice;
} catch (error) {
return value;
}
try {
value7 = Reflect.apply(slice, value6, [0, 6]);
} catch (error) {
return value;
}
try {
map = value7.map;
} catch (error) {
return value;
}
try {
closure = function(a0) {
var r0;
var r1;
var r3;
var item3;
var value3;
var iterator = a0[Symbol.iterator]();
var iterator2 = iterator.next;
var item2 = Reflect.apply(iterator2, iterator, []);
var item = item2.value;
item2 = item2.done ? undefined : iterator;
var value = undefined;
var value2 = item2 === value;
var r4 = value2 ? value : item;
if (value2) {
r0 = item2;
r1 = value2;
r3 = value;
} else {
item3 = Reflect.apply(iterator2, item2, []);
item = item3.value;
item3 = item3.done ? undefined : item2;
value3 = item3 === value;
if (value3) {
r0 = item3;
r1 = value3;
r3 = value;
} else {
r0 = item3;
r1 = value3;
r3 = item;
}
}
if (!r1) {
r0.return();
}
return '' + r4 + '=' + r3;
};
} catch (error) {
return value;
}
try {
value8 = Reflect.apply(map, value7, [closure]);
} catch (error) {
return value;
}
try {
length = value8.length;
} catch (error) {
return value;
}
try {
value9 = length > 0;
} catch (error) {
return value;
}
if (value9) {
try {
join = value8.join;
} catch (error) {
return value;
}
try {
value10 = Reflect.apply(join, value8, [', ']);
} catch (error) {
return value;
}
r1 = value10;
} else {
r1 = value;
}
return r1;
}
function _fun46726(a0) { // fn#46726, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:765, offset: 0x011adea0, size: 721 bytes, params: 2, frame: 16
const closure = ProcessUtilsIOS;
env0_4(closure, a0);
return env0_1(closure, [{key: 'getProcessUptime', value: function() {
return null;
}}, {key: 'getCumulativeCPUUsage', value: function() {
return this.cumulativeCpuUsage;
}}, {key: 'getCurrentCPUUsagePercent', value: function() {
return this.cpuPercentage;
}}, {key: 'getCurrentMemoryUsageKB', value: function() {
return this.memory;
}}, {key: 'setShouldCollectHermesInstrumentedStats', value: function(a0) {
this.shouldCollectHermesInstrumentedStats = a0;
var value = undefined;
this.hermesInstrumentedStatsSummary = a0 ? getHermesInstrumentedStatsSummary() : value;
return value;
}}, {key: 'getCurrentHermesInstrumentedStatsSummary', value: function() {
if (this.shouldCollectHermesInstrumentedStats) {
return this.hermesInstrumentedStatsSummary;
}
}}, {key: 'enablePerfMemoryHooks', value: function() {
return null;
}}, {key: 'disablePerfMemoryHooks', value: function() {
return null;
}}, {key: 'getPerfAttributedMemory', value: function() {
return null;
}}, {key: 'getPerfAttributedMemoryCallstacks', value: function() {
return null;
}}, {key: 'getPerfAttributedMemoryStats', value: function() {
return null;
}}, {key: 'startCPUProfiling', value: function() {
return null;
}}, {key: 'stopCPUProfiling', value: function() {
var Promise = global.Promise;
return Promise.resolve(null);
}}, {key: 'enablePAMemoryProfiler', value: function() {
return null;
}}, {key: 'disablePAMemoryProfiler', value: function() {
return null;
}}, {key: 'getPerfAttributedPAMemory', value: function() {
return null;
}}, {key: 'getPerfAttributedPAMemoryCallstacks', value: function() {
return null;
}}, {key: 'getPartitionAllocatorStats', value: function() {
return null;
}}, {key: 'enableProfilingV8Heap', value: function() {
}}, {key: 'disableProfilingV8Heap', value: function() {
}}, {key: 'getProfilerV8MemoryCallstacks', value: function() {
return null;
}}, {key: 'getMemoryUsageDetails', value: function() {
return {[0]: this.memory};
}}, {key: 'getMemoryUsageElectronRenderer', value: function() {
return null;
}}, {key: 'getMemoryPrivateUsageElectronRenderer', value: function() {
return null;
}}, {key: 'getMemoryUsageElectronRendererUsedHeapSize', value: function() {
return null;
}}, {key: 'getMemoryHeapStats', value: function() {
return null;
}}, {key: 'getBlinkMemoryInfo', value: function() {
return null;
}}, {key: 'getMemoryUsageElectronProcessTypeDetails', value: function() {
return null;
}}]);
}
function ProcessUtilsIOS() { // fn#46727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:777, offset: 0x011ae171, size: 212 bytes, params: 1, frame: 21
var environment;
const value = environment.__proto__;
const binding = env1_0;
const value3 = undefined;
binding(this, ProcessUtilsIOS);
const value4 = env1_3(ProcessUtilsIOS);
const value7 = env1_2(this, _isNativeReflectConstruct_46720() ? global.Reflect.construct(value4, [],
env1_3(this).constructor) : value4.apply(this, value3));
value7.shouldCollectHermesInstrumentedStats = false;
const SystemResourceManager = NativeModules == null ? value3 : NativeModules.SystemResourceManager;
if (!(SystemResourceManager == null || SystemResourceManager.getCpuCoreCount == null)) {
SystemResourceManager.getCpuCoreCount(_fun46728);
}
global.setInterval(_fun46729, 1000);
return value7;
}
function _fun46728(a0) { // fn#46728, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:1137, offset: 0x011ae245, size: 20 bytes, params: 2, frame: 2
env0_0.cpuCoreCount = a0;
}
function _fun46729() { // fn#46729, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:1174, offset: 0x011ae259, size: 187 bytes, params: 1, frame: 14
if (!(SystemResourceManager == null || SystemResourceManager.getCurrentCpuUsagePercent == null)) {
SystemResourceManager.getCurrentCpuUsagePercent(_fun46730);
}
if (!(SystemResourceManager == null || SystemResourceManager.getCumulativeCpuUsage == null)) {
SystemResourceManager.getCumulativeCpuUsage(_fun46731);
}
if (!(SystemResourceManager == null || SystemResourceManager.getCurrentMemoryUsageKb == null)) {
SystemResourceManager.getCurrentMemoryUsageKb(_fun46732);
}
const binding = env0_0;
const shouldCollectHermesInstrumentedStats = binding.shouldCollectHermesInstrumentedStats;
const value = undefined;
binding.hermesInstrumentedStatsSummary = shouldCollectHermesInstrumentedStats ? getHermesInstrumentedStatsSummary() : value;
return value;
}
function _fun46730(a0) { // fn#46730, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:1252, offset: 0x011ae314, size: 34 bytes, params: 2, frame: 5
const value = a0;
const binding = env1_0;
const value3 = undefined;
binding.cpuPercentage = value >= 0 ? value : value3;
return value3;
}
function _fun46731(a0) { // fn#46731, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:1354, offset: 0x011ae336, size: 55 bytes, params: 2, frame: 11
var value;
var binding;
var object2;
if (a0 >= 0) {
value = environment.__proto__;
binding = env1_0;
object2 = {usage: a0};
object2.sampleTime = global.performance.now();
binding.cumulativeCpuUsage = object2;
}
}
function _fun46732(a0) { // fn#46732, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5434:1498, offset: 0x011ae36d, size: 34 bytes, params: 2, frame: 5
const value = a0;
const binding = env1_0;
const value3 = undefined;
binding.memory = value >= 0 ? value : value3;
return value3;
}