MCPcopy Create free account
hub / github.com/Snapchat/Valdi / newFunction

Method newFunction

valdi/src/valdi/jscore/JavaScriptCoreContext.cpp:340–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

338}
339
340Valdi::JavaScriptContextMemoryStatistics JavaScriptCoreContext::dumpMemoryStatistics() {
341 if (s_dumpMemoryStatisticsOverride) {
342 return s_dumpMemoryStatisticsOverride(_globalContext);
343 }
344
345 Valdi::JavaScriptContextMemoryStatistics out;
346
347 if constexpr (!snap::kIsAppstoreBuild || !snap::isIos()) {
348 // JSGetMemoryUsageStatistics() is currently a private symbol, so we use it
349 // only on Android/Desktop or non production iOS.
350
351 if (JSGetMemoryUsageStatistics) {
352 auto memoryUsageJs = JSGetMemoryUsageStatistics(_globalContext);
353
354 if (!memoryUsageJs) {
355 return out;
356 }
357
358 Valdi::JSExceptionTracker exceptionTracker(*this);
359 auto memoryUsage = Valdi::jsValueToValue(
360 *this,
361 toValdiJSValue(JSCoreRef(memoryUsageJs, JSValueGetType(_globalContext, memoryUsageJs))),
362 Valdi::ReferenceInfoBuilder(),

Callers

nothing calls this directly

Calls 7

unsafeBridgeRetainFunction · 0.85
fromValdiJSValueFunction · 0.70
getMethod · 0.65
isEmptyMethod · 0.45
getNameMethod · 0.45
toStringViewMethod · 0.45

Tested by

no test coverage detected