Files
discord-decomp/sources/by-id/module-01110-startProfileForSpan.js
T
2026-07-28 01:06:53 +03:00

169 lines
9.0 KiB
JavaScript

/* Metro module 1110; source: unknown; dependencies: [5, 1109, 826, 1080, 1036] */
import * as Module00005Module from './module-00005.js'; /* Metro dependency 5 */
function _fun12448(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#12448, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:6, offset: 0x00dcc0d7, size: 93 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
exports.startProfileForSpan = startProfileForSpan;
function startProfileForSpan(a0) { // fn#12449, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:127, offset: 0x00dcc134, size: 432 bytes, params: 2, frame: 20
var debug;
var log;
var moduleValue4;
var currentScope;
var WINDOW;
const env0_0 = a0;
const onProfileHandler = function() {
return _onProfileHandler.apply(this, arguments);
};
var value;
const value2 = undefined;
const moduleValue = require(1109) /* metro dependency 1109 */;
if (moduleValue.startJSSelfProfile()) {
if ((require(1080) /* metro dependency 1080 */).DEBUG_BUILD) {
debug = (require(826) /* metro dependency 826 */).debug;
log = debug.log;
moduleValue4 = require(826) /* metro dependency 826 */;
Reflect.apply(log, debug,
['[Profiling] started profiling span: ' + moduleValue4.spanToJSON(a0).description]);
}
value = require(826) /* metro dependency 826 */;
value = value.uuid4();
currentScope = (require(826) /* metro dependency 826 */).getCurrentScope();
currentScope.setContext('profile', {profile_id: value,
start_timestamp: moduleValue.isAutomatedPageLoadSpan(a0) ? 1000 * (require(826) /* metro dependency 826 */).timestampInSeconds() : value2});
WINDOW = (require(1036) /* metro dependency 1036 */).WINDOW;
var env0_4 = WINDOW.setTimeout(_fun12456, (require(1109) /* metro dependency 1109 */).MAX_PROFILE_DURATION_MS);
var env0_5 = a0.end.bind(a0);
a0.end = end_12457;
}
return value2;
function _onProfileHandler() { // fn#12451, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:955, owner: startProfileForSpan._onProfileHandler, offset: 0x00dcc2e4, size: 50 bytes, params: 1, frame: 13
var environment;
const value = environment.__proto__;
return env1_2(_fun12453).apply(this, arguments);
function* _fun12453() { // fn#12453, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:1012, offset: 0x00dcc31f, size: 212 bytes, params: 1, frame: 18
var environment;
var value3;
var binding;
var binding2;
var debug;
var log;
var value4;
if (true) {
value = environment.__proto__.__proto__;
if (require) {
if (dependencyMap) {
if (env2_3) {
value3 = environment.__proto__.__proto__.__proto__;
binding = env3_0;
if (binding(env3_1[3]).DEBUG_BUILD) {
binding = env3_0;
binding2 = env3_1;
debug = binding(binding2[2]).debug;
log = debug.log;
value4 = binding(binding2[2]);
Reflect.apply(log, debug, ['[Profiling] profile for:', value4.spanToJSON(require).description,
'already exists, returning early']);
}
return undefined;
}
value = dependencyMap.stop();
value = value.then(_fun12454);
return value.catch(_fun12455);
}
}
}
function _fun12454(a0) { // fn#12454, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:1061, offset: 0x00dcc3f3, size: 363 bytes, params: 2, frame: 19
var value2;
var binding;
var binding2;
var debug;
var log;
var value4;
var binding3;
var value5;
const value = environment.__proto__.__proto__.__proto__;
if (env3_4) {
value2 = environment.__proto__.__proto__.__proto__.__proto__;
env4_0(env4_1[4]).WINDOW.clearTimeout(env3_4);
}
const DEBUG_BUILD = env4_0(env4_1[3]).DEBUG_BUILD;
if (DEBUG_BUILD) {
binding = env4_0;
binding2 = env4_1;
debug = binding(binding2[2]).debug;
log = debug.log;
value4 = binding(binding2[2]);
Reflect.apply(log, debug, ['[Profiling] stopped profiling of span: ' + value4.spanToJSON(require).description]);
}
if (a0) {
env3_3 = a0;
env4_0(env4_1[1]).addProfileToGlobalCache(env3_2, a0);
} else {
binding = env4_0;
if (binding(env4_1[3]).DEBUG_BUILD) {
binding = env4_0;
binding3 = env4_1;
debug = binding(binding3[2]).debug;
log = debug.log;
value5 = binding(binding3[2]);
Reflect.apply(log, debug,
['[Profiling] profiler returned null profile for: ' + value5.spanToJSON(require).description,
'this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started']);
}
}
}
function _fun12455(a0) { // fn#12455, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:1529, offset: 0x00dcc55e, size: 83 bytes, params: 2, frame: 14
if (env4_0(env4_1[3]).DEBUG_BUILD) {
env4_0(env4_1[2]).debug.log('[Profiling] error while stopping profiler:', a0);
}
}
}
}
function _fun12456() { // fn#12456, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:537, offset: 0x00dcc5b1, size: 123 bytes, params: 1, frame: 15
var debug;
var log;
let value = environment.__proto__;
if ((require(1080) /* metro dependency 1080 */).DEBUG_BUILD) {
debug = (require(826) /* metro dependency 826 */).debug;
log = debug.log;
value = require(826) /* metro dependency 826 */;
Reflect.apply(log, debug, ['[Profiling] max profile duration elapsed, stopping profiling for:',
value.spanToJSON(env0_0).description]);
}
onProfileHandler();
}
function startProfileForSpanEnd() { // fn#12457, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:766, owner: startProfileForSpan.end, offset: 0x00dcc62c, size: 61 bytes, params: 1, frame: 15
var r0;
if (env0_0) {
onProfileHandler().then(_fun12458, _fun12459);
r0 = env0_0;
} else {
r0 = env0_5();
}
return r0;
function _fun12458() { // fn#12458, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:836, offset: 0x00dcc669, size: 15 bytes, params: 1, frame: 9
env1_5();
}
function _fun12459() { // fn#12459, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1237:854, offset: 0x00dcc669, size: 15 bytes, params: 1, frame: 9
env1_5();
}
}
}
}
global.__d(_fun12448, 1110, [5, 1109, 826, 1080,
1036]) /* metro module 1110, dependencies: [5, 1109, 826, 1080, 1036] */;