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

Method handleProfilerStop

valdi/src/valdi/hermes/HermesDebuggerConnection.cpp:188–203  ·  view source on GitHub ↗

Compatability workaround for proper Source mapping in Hermes Profiler Replace scriptIds in the profile nodes with the actual scriptIds based on the URL

Source from the content-addressed store, hash-verified

186// Compatability workaround for proper Source mapping in Hermes Profiler
187// Replace scriptIds in the profile nodes with the actual scriptIds based on the URL
188void HermesDebuggerConnection::handleProfilerStop(const Value& message) {
189 auto nodeArray = message.getMapValue("result").getMapValue("profile").getMapValue("nodes").getArrayRef();
190 if (nodeArray != nullptr) {
191 for (size_t i = 0; i < nodeArray->size(); i++) {
192 auto callFrame = (*nodeArray)[i].getMapValue("callFrame");
193 auto functionName = callFrame.getMapValue("functionName").toStringBox();
194 callFrame.setMapValue("functionName", Value(cleanFunctionName(functionName)));
195 auto url = callFrame.getMapValue("url").toStringBox();
196 if (_scriptIdsByUrl.find(url) != _scriptIdsByUrl.end()) {
197 auto scriptId = _scriptIdsByUrl[url];
198 callFrame.setMapValue("scriptId", Value(scriptId));
199 }
200 }
201 }
202 submitMessageToCDP(message);
203}
204
205// Compatability workaround for debugging Hermes with Block Scoping enabled
206// Issue outlined here: https://github.com/facebook/hermes/issues/1355. Should be fixed in a future release of Static

Callers

nothing calls this directly

Calls 8

cleanFunctionNameFunction · 0.85
getArrayRefMethod · 0.80
getMapValueMethod · 0.80
endMethod · 0.65
ValueClass · 0.50
sizeMethod · 0.45
toStringBoxMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected