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 if constexpr (!snap::kIsAppstoreBuild || !snap::isIos()) {
340 // JSGetMemoryUsageStatistics() is currently a private symbol, so we use it
341 // only on Android/Desktop or non production iOS.
342
343 if (JSGetMemoryUsageStatistics) {
344 auto memoryUsageJs = JSGetMemoryUsageStatistics(_globalContext);
345
346 if (!memoryUsageJs) {
347 return out;
348 }
349
350 Valdi::JSExceptionTracker exceptionTracker(*this);
351 auto memoryUsage = Valdi::jsValueToValue(
352 *this,
353 toValdiJSValue(JSCoreRef(memoryUsageJs, JSValueGetType(_globalContext, memoryUsageJs))),
354 Valdi::ReferenceInfoBuilder(),
355 exceptionTracker);
356
357 exceptionTracker.clearError();
358
359 out.memoryUsageBytes = static_cast<size_t>(memoryUsage.getMapValue("heapCapacity").toLong());
360 out.objectsCount = static_cast<size_t>(memoryUsage.getMapValue("objectCount").toLong());
361 }
362 }

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