2026-07-20 16:05:17 +00:00
// Module ID: 1078
2026-07-25 08:10:48 +00:00
// Function ID: 12422
2026-07-20 16:05:17 +00:00
// Name: startProfileForSpan
2026-07-23 10:11:24 +00:00
// Dependencies: [5, 1077, 794, 1048, 1004]
2026-07-20 16:05:17 +00:00
// Exports: startProfileForSpan
// Module 1078 (startProfileForSpan)
2026-07-23 10:11:24 +00:00
import asyncGeneratorStep from "asyncGeneratorStep" ;
2026-07-20 16:05:17 +00:00
Object . defineProperty ( exports , Symbol . toStringTag , { value : "Module" } ) ;
export const startProfileForSpan = function startProfileForSpan ( rootSpan ) {
2026-07-23 10:11:24 +00:00
const _require = rootSpan ;
2026-07-20 16:05:17 +00:00
function onProfileHandler ( ) {
return _onProfileHandler ( ... arguments ) ;
}
async function _onProfileHandler ( ) {
if ( obj ) {
return obj . resume ( ) ;
2026-07-23 10:11:24 +00:00
} else if ( outer2 _0 ) {
if ( outer2 _1 ) {
if ( outer2 _3 ) {
if ( callback ( startJSSelfProfileResult [ 3 ] ) . DEBUG _BUILD ) {
let debug = callback ( startJSSelfProfileResult [ 2 ] ) . debug ;
debug . log ( "[Profiling] profile for:" , callback ( startJSSelfProfileResult [ 2 ] ) . spanToJSON ( outer2 _0 ) . description , "already exists, returning early" ) ;
let obj2 = callback ( startJSSelfProfileResult [ 2 ] ) ;
2026-07-20 16:05:17 +00:00
}
} else {
2026-07-23 10:11:24 +00:00
const stopResult = outer2 _1 . stop ( ) ;
return outer2 _1 . stop ( ) . then ( ( arg0 ) => {
if ( outer3 _4 ) {
const WINDOW = callback ( startJSSelfProfileResult [ 4 ] ) . WINDOW ;
WINDOW . clearTimeout ( outer3 _4 ) ;
outer3 _4 = undefined ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( callback ( startJSSelfProfileResult [ 3 ] ) . DEBUG _BUILD ) {
const debug = callback ( startJSSelfProfileResult [ 2 ] ) . debug ;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal ;
2026-07-23 10:11:24 +00:00
debug . log ( "[Profiling] stopped profiling of span: " + callback ( startJSSelfProfileResult [ 2 ] ) . spanToJSON ( outer3 _0 ) . description ) ;
const obj = callback ( startJSSelfProfileResult [ 2 ] ) ;
2026-07-20 16:05:17 +00:00
}
if ( arg0 ) {
2026-07-23 10:11:24 +00:00
const outer3 _3 = arg0 ;
const result = callback ( startJSSelfProfileResult [ 1 ] ) . addProfileToGlobalCache ( outer3 _2 , arg0 ) ;
const obj3 = callback ( startJSSelfProfileResult [ 1 ] ) ;
} else if ( callback ( startJSSelfProfileResult [ 3 ] ) . DEBUG _BUILD ) {
const debug2 = callback ( startJSSelfProfileResult [ 2 ] ) . debug ;
2026-07-20 16:05:17 +00:00
const _HermesInternal2 = HermesInternal ;
2026-07-23 10:11:24 +00:00
debug2 . log ( "[Profiling] profiler returned null profile for: " + callback ( startJSSelfProfileResult [ 2 ] ) . spanToJSON ( outer3 _0 ) . description , "this may indicate an overlapping span or a call to stopProfiling with a profile title that was never started" ) ;
const obj2 = callback ( startJSSelfProfileResult [ 2 ] ) ;
2026-07-20 16:05:17 +00:00
}
} ) . catch ( ( arg0 ) => {
2026-07-23 10:11:24 +00:00
if ( callback ( startJSSelfProfileResult [ 3 ] ) . DEBUG _BUILD ) {
const debug = callback ( startJSSelfProfileResult [ 2 ] ) . debug ;
2026-07-20 16:05:17 +00:00
debug . log ( "[Profiling] error while stopping profiler:" , arg0 ) ;
}
} ) ;
}
}
}
}
2026-07-23 10:11:24 +00:00
let obj = _require ( 1077 ) ;
2026-07-20 16:05:17 +00:00
if ( obj . isAutomatedPageLoadSpan ( rootSpan ) ) {
2026-07-23 10:11:24 +00:00
let result = 1000 * _require ( 794 ) . timestampInSeconds ( ) ;
let obj2 = _require ( 794 ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const startJSSelfProfileResult = _require ( 1077 ) . startJSSelfProfile ( ) ;
2026-07-20 16:05:17 +00:00
const dependencyMap = startJSSelfProfileResult ;
if ( startJSSelfProfileResult ) {
2026-07-23 10:11:24 +00:00
if ( _require ( 1048 ) . DEBUG _BUILD ) {
let debug = _require ( 794 ) . debug ;
let _HermesInternal = HermesInternal ;
debug . log ( "[Profiling] started profiling span: " + _require ( 794 ) . spanToJSON ( rootSpan ) . description ) ;
const obj4 = _require ( 794 ) ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
const uuid4Result = _require ( 794 ) . uuid4 ( ) ;
const asyncGeneratorStep = uuid4Result ;
let c3 = null ;
const obj5 = _require ( 794 ) ;
const currentScope = _require ( 794 ) . getCurrentScope ( ) ;
2026-07-20 16:05:17 +00:00
obj = { profile _id : uuid4Result , start _timestamp : result } ;
currentScope . setContext ( "profile" , obj ) ;
2026-07-23 10:11:24 +00:00
let WINDOW = _require ( 1004 ) . WINDOW ;
2026-07-20 16:05:17 +00:00
const timeout = WINDOW . setTimeout ( ( ) => {
2026-07-23 10:11:24 +00:00
if ( callback ( startJSSelfProfileResult [ 3 ] ) . DEBUG _BUILD ) {
const debug = callback ( startJSSelfProfileResult [ 2 ] ) . debug ;
debug . log ( "[Profiling] max profile duration elapsed, stopping profiling for:" , callback ( startJSSelfProfileResult [ 2 ] ) . spanToJSON ( callback ) . description ) ;
const obj = callback ( startJSSelfProfileResult [ 2 ] ) ;
2026-07-20 16:05:17 +00:00
}
onProfileHandler ( ) ;
2026-07-23 10:11:24 +00:00
} , _require ( 1077 ) . MAX _PROFILE _DURATION _MS ) ;
2026-07-20 16:05:17 +00:00
const end = rootSpan . end ;
let closure _5 = end . bind ( rootSpan ) ;
rootSpan . end = function profilingWrappedSpanEnd ( ) {
2026-07-23 10:11:24 +00:00
if ( closure _0 ) {
2026-07-20 16:05:17 +00:00
onProfileHandler ( ) . then ( ( ) => {
2026-07-23 10:11:24 +00:00
outer1 _5 ( ) ;
2026-07-20 16:05:17 +00:00
} , ( ) => {
2026-07-23 10:11:24 +00:00
outer1 _5 ( ) ;
2026-07-20 16:05:17 +00:00
} ) ;
2026-07-23 10:11:24 +00:00
let tmp2 = closure _0 ;
2026-07-20 16:05:17 +00:00
const promise = onProfileHandler ( ) ;
} else {
2026-07-23 10:11:24 +00:00
tmp2 = callback2 ( ) ;
2026-07-20 16:05:17 +00:00
}
return tmp2 ;
} ;
2026-07-23 10:11:24 +00:00
const obj6 = _require ( 794 ) ;
2026-07-20 16:05:17 +00:00
}
} ;