307 lines
11 KiB
JavaScript
307 lines
11 KiB
JavaScript
// Metro module 156 (f157).
|
|
import _classCallCheck from "./_classCallCheck";
|
|
import _createClass from "./_createClass";
|
|
import _classPrivateFieldBase from "./_classPrivateFieldBase";
|
|
import _classPrivateFieldKey from "./_classPrivateFieldKey";
|
|
import nullthrows from "./nullthrows";
|
|
import Module154 from "./Module154";
|
|
import DOMException2 from "./DOMException";
|
|
import { EventCounts } from "./PerformanceEventTiming";
|
|
import { getCurrentTimeStamp } from "./Module164";
|
|
import MemoryInfo from "./MemoryInfo";
|
|
import ReactNativeStartupTiming from "./ReactNativeStartupTiming";
|
|
import structuredClone2 from "./structuredClone";
|
|
import { PerformanceMark, PerformanceMeasure } from "./PerformanceMarkTemplate";
|
|
import { rawToPerformanceEntry, performanceEntryTypeToRaw } from "./Module170";
|
|
import { setPlatformObject } from "./Module126";
|
|
let c158_16;
|
|
let Performance2;
|
|
let env158 = {};
|
|
const _excluded = ["mark", "measure"];
|
|
const c158_7 = nullthrows(Module154);
|
|
const { reportMark, reportMeasure, getMarkTime, clearMarks: clearMarks2, clearMeasures: clearMeasures2 } = c158_7;
|
|
const c158_13 = {
|
|
startTime: 0,
|
|
detail: void 0
|
|
};
|
|
const c158_14 = {
|
|
name: "",
|
|
startTime: 0,
|
|
duration: 0,
|
|
detail: void 0
|
|
};
|
|
const getMarkTimeForMeasure = (a0) => {};
|
|
c158_16 = _classPrivateFieldKey("eventCounts");
|
|
Performance2 = function Performance() {
|
|
_classCallCheck(this, Performance2);
|
|
Object.defineProperty(this, c158_16, {
|
|
writable: true,
|
|
value: new EventCounts()
|
|
});
|
|
this.now = getCurrentTimeStamp;
|
|
};
|
|
const r61 = _createClass(Performance2, [{
|
|
key: "eventCounts",
|
|
get: function get() {
|
|
return _classPrivateFieldBase(this, c158_16)[c158_16];
|
|
}
|
|
}, {
|
|
key: "memory",
|
|
get: function get() {
|
|
const simpleMemoryInfo = c158_7.getSimpleMemoryInfo();
|
|
if (simpleMemoryInfo.hasOwnProperty("hermes_heapSize")) {
|
|
return new MemoryInfo({
|
|
jsHeapSizeLimit: null,
|
|
totalJSHeapSize: simpleMemoryInfo.hermes_heapSize,
|
|
usedJSHeapSize: simpleMemoryInfo.hermes_allocatedBytes
|
|
});
|
|
}
|
|
return new MemoryInfo();
|
|
}
|
|
}, {
|
|
key: "rnStartupTiming",
|
|
get: function get() {
|
|
const reactNativeStartupTiming = c158_7.getReactNativeStartupTiming();
|
|
return new ReactNativeStartupTiming({
|
|
startTime: reactNativeStartupTiming.startTime,
|
|
initializeRuntimeStart: reactNativeStartupTiming.initializeRuntimeStart,
|
|
executeJavaScriptBundleEntryPointStart: reactNativeStartupTiming.executeJavaScriptBundleEntryPointStart,
|
|
endTime: reactNativeStartupTiming.endTime
|
|
});
|
|
}
|
|
}, {
|
|
key: "timeOrigin",
|
|
get: function get() {
|
|
if (env158[3] == null) {
|
|
env158[3] = c158_7.timeOrigin ? c158_7 == null ? void 0 : c158_7.timeOrigin() : Date.now() - getCurrentTimeStamp();
|
|
}
|
|
return env158[3];
|
|
}
|
|
}, {
|
|
key: "mark",
|
|
value: function mark(a0, a1) {
|
|
let startTime;
|
|
if (a0 === void 0) {
|
|
throw new TypeError("Failed to execute 'mark' on 'Performance': 1 argument required, but only 0 present.");
|
|
}
|
|
const r7 = typeof a0 !== "string" ? String(a0) : a0;
|
|
const r16 = a1 != null;
|
|
let r8 = void 0;
|
|
let r9 = void 0;
|
|
if (r16) {
|
|
r9 = a1.startTime;
|
|
r8 = a1.detail;
|
|
}
|
|
L12: {
|
|
if (r9 !== void 0) {
|
|
let r23 = r9;
|
|
if (typeof r23 !== "number") {
|
|
r23 = Number(r9);
|
|
}
|
|
if (r23 < 0) {
|
|
throw new TypeError(`Failed to execute 'mark' on 'Performance': '${r7}' cannot have a negative start time.`);
|
|
}
|
|
if (r23 == r23) {
|
|
startTime = r23;
|
|
if (startTime !== Infinity) {
|
|
break L12;
|
|
}
|
|
}
|
|
throw new TypeError("Failed to execute 'mark' on 'Performance': Failed to read the 'startTime' property from 'PerformanceMarkOptions': The provided double value is non-finite.");
|
|
}
|
|
startTime = getCurrentTimeStamp();
|
|
}
|
|
const detail = r8 !== void 0 ? structuredClone2(r8) : void 0;
|
|
c158_13.startTime = startTime;
|
|
c158_13.detail = detail;
|
|
const performanceMark = new PerformanceMark(r7, c158_13);
|
|
reportMark(r7, startTime, performanceMark);
|
|
return performanceMark;
|
|
}
|
|
}, {
|
|
key: "clearMarks",
|
|
value: function clearMarks(a0) {
|
|
clearMarks2(a0);
|
|
}
|
|
}, {
|
|
key: "measure",
|
|
value: function measure(a0, a1, a2) {
|
|
let r61, r104, detail2, duration2, startTime;
|
|
if (a0 === void 0) {
|
|
throw new TypeError("Failed to execute 'measure' on 'Performance': 1 argument required, but only 0 present.");
|
|
}
|
|
const name = typeof a0 !== "string" ? String(a0) : a0;
|
|
if (a1 != null) {
|
|
const r47 = typeof a1;
|
|
if (r47 === "object") {
|
|
if (a2 !== void 0) {
|
|
throw new TypeError("Failed to execute 'measure' on 'Performance': If a non-empty PerformanceMeasureOptions object was passed, |end_mark| must not be passed.");
|
|
}
|
|
const { start, end, duration, detail } = a1;
|
|
if (start !== void 0 && end !== void 0 && duration !== void 0) {
|
|
throw new TypeError("Failed to execute 'measure' on 'Performance': If a non-empty PerformanceMeasureOptions object was passed, it must not have all of its 'start', 'duration', and 'end' properties defined");
|
|
}
|
|
const r142 = typeof start;
|
|
let r144 = void 0;
|
|
if (r142 !== "undefined") {
|
|
if (r142 === "number") {
|
|
r144 = start;
|
|
} else if (r142 === "string") {
|
|
r144 = getMarkTime(start);
|
|
if (r144 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${start}' does not exist.`, "SyntaxError");
|
|
}
|
|
} else {
|
|
const r18 = String(start);
|
|
r144 = getMarkTime(r18);
|
|
if (r144 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${r18}' does not exist.`, "SyntaxError");
|
|
}
|
|
}
|
|
}
|
|
const r185 = typeof end;
|
|
let r186 = void 0;
|
|
if (r185 !== "undefined") {
|
|
if (r185 === "number") {
|
|
r186 = end;
|
|
} else if (r185 === "string") {
|
|
r186 = getMarkTime(end);
|
|
if (r186 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${end}' does not exist.`, "SyntaxError");
|
|
}
|
|
} else {
|
|
const r192 = String(end);
|
|
r186 = getMarkTime(r192);
|
|
if (r186 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${r192}' does not exist.`, "SyntaxError");
|
|
}
|
|
}
|
|
}
|
|
const r229 = typeof duration;
|
|
let r230 = void 0;
|
|
if (r229 !== "undefined") {
|
|
if (r229 === "number") {
|
|
r230 = duration;
|
|
} else {
|
|
const r234 = Number(duration);
|
|
const isFinite2 = Number.isFinite(r234);
|
|
r230 = r234;
|
|
if (!isFinite2) {
|
|
throw new TypeError("Failed to execute 'measure' on 'Performance': Failed to read the 'duration' property from 'PerformanceMeasureOptions': The provided double value is non-finite.");
|
|
}
|
|
}
|
|
}
|
|
if (r144 === void 0) {
|
|
r144 = r186 !== void 0 ? r230 !== void 0 ? r186 - r230 : 0 : 0;
|
|
}
|
|
if (r230 === void 0) {
|
|
r230 = r144 !== void 0 && r186 !== void 0 ? r186 - r144 : getCurrentTimeStamp() - r144;
|
|
}
|
|
detail2 = void 0;
|
|
duration2 = r230;
|
|
startTime = r144;
|
|
if (detail !== void 0) {
|
|
detail2 = structuredClone2(detail);
|
|
duration2 = r230;
|
|
startTime = r144;
|
|
}
|
|
} else if (r47 === "string") {
|
|
const r97 = getMarkTime(a1);
|
|
if (r97 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${a1}' does not exist.`, "SyntaxError");
|
|
}
|
|
if (a2 !== void 0) {
|
|
const r107 = getMarkTime(a2);
|
|
if (r107 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${a2}' does not exist.`, "SyntaxError");
|
|
}
|
|
r104 = r107 - r97;
|
|
} else {
|
|
r104 = getCurrentTimeStamp() - r97;
|
|
}
|
|
duration2 = r104;
|
|
detail2 = void 0;
|
|
startTime = r97;
|
|
} else {
|
|
const r14 = String(a1);
|
|
const r55 = getMarkTime(r14);
|
|
if (r55 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${r14}' does not exist.`, "SyntaxError");
|
|
}
|
|
if (a2 !== void 0) {
|
|
const r64 = getMarkTime(a2);
|
|
if (r64 == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${a2}' does not exist.`, "SyntaxError");
|
|
}
|
|
r61 = r64 - r55;
|
|
} else {
|
|
r61 = getCurrentTimeStamp() - r55;
|
|
}
|
|
duration2 = r61;
|
|
detail2 = void 0;
|
|
startTime = r55;
|
|
}
|
|
} else {
|
|
if (a2 !== void 0) {
|
|
const markTime = getMarkTime(a2);
|
|
if (markTime == null) {
|
|
throw new DOMException2(`Failed to execute 'measure' on 'Performance': The mark '${a2}' does not exist.`, "SyntaxError");
|
|
}
|
|
duration2 = markTime - 0;
|
|
} else {
|
|
duration2 = getCurrentTimeStamp() - 0;
|
|
}
|
|
detail2 = void 0;
|
|
startTime = 0;
|
|
}
|
|
c158_14.name = name;
|
|
c158_14.startTime = startTime;
|
|
c158_14.duration = duration2;
|
|
c158_14.detail = detail2;
|
|
const performanceMeasure = new PerformanceMeasure(c158_14);
|
|
reportMeasure(name, startTime, duration2, performanceMeasure);
|
|
return performanceMeasure;
|
|
}
|
|
}, {
|
|
key: "clearMeasures",
|
|
value: function clearMeasures(a0) {
|
|
clearMeasures2(a0);
|
|
}
|
|
}, {
|
|
key: "getEntries",
|
|
value: function getEntries() {
|
|
return c158_7.getEntries().map(rawToPerformanceEntry);
|
|
}
|
|
}, {
|
|
key: "getEntriesByType",
|
|
value: function getEntriesByType(a0) {
|
|
let r14;
|
|
if (a0 != null && !_excluded.includes(a0)) {
|
|
console.warn("Deprecated API for given entry type.");
|
|
r14 = [];
|
|
} else {
|
|
r14 = c158_7.getEntriesByType(performanceEntryTypeToRaw(a0)).map(rawToPerformanceEntry);
|
|
}
|
|
return r14;
|
|
}
|
|
}, {
|
|
key: "getEntriesByName",
|
|
value: function getEntriesByName(a0, a1) {
|
|
let r15;
|
|
if (a1 != null && !_excluded.includes(a1)) {
|
|
console.warn("Deprecated API for given entry type.");
|
|
r15 = [];
|
|
} else {
|
|
r15 = c158_7.getEntriesByName(a0, a1 != null ? performanceEntryTypeToRaw(a1) : void 0).map(rawToPerformanceEntry);
|
|
}
|
|
return r15;
|
|
}
|
|
}]);
|
|
const Performance3 = function Performance() {
|
|
throw new TypeError("Failed to construct 'Performance': Illegal constructor");
|
|
};
|
|
Performance3.prototype = r61.prototype;
|
|
setPlatformObject(r61);
|
|
export default r61;
|
|
export { Performance3 as Performance_public };
|