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

Method setTargetList

valdi/src/valdi/jscore/JSCoreDebuggerProxy.cpp:145–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void JSDebuggerConnection::setTargetList(const Valdi::StringBox& message) {
146 auto convertedValue = Valdi::jsonToValue(message.toStringView());
147
148 if (!convertedValue) {
149 VALDI_ERROR(
150 Valdi::ConsoleLogger::getLogger(), "[JSDebugger] Failed to parse message: {}", convertedValue.error());
151 return;
152 }
153
154 auto* items = convertedValue.value().getArray();
155 if (items == nullptr || items->empty()) {
156 _targetId = 0;
157 return;
158 }
159
160 // TODO(simon): This is hardcoded to expose just a single target.
161 // If we wanted to support multiple targets, we would have to make
162 // the external proxy protocol aware of target ids.
163 _targetId = (*items)[0].getMapValue("targetID").toInt();
164}
165
166int JSDebuggerConnection::getTargetId() const {
167 return _targetId;

Callers

nothing calls this directly

Calls 8

getMapValueMethod · 0.80
errorMethod · 0.65
valueMethod · 0.65
jsonToValueFunction · 0.50
toStringViewMethod · 0.45
getArrayMethod · 0.45
emptyMethod · 0.45
toIntMethod · 0.45

Tested by

no test coverage detected