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

Method encodeMessage

valdi/src/valdi/runtime/JavaScript/Modules/ProtobufArena.cpp:153–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153BytesView ProtobufArena::encodeMessage(size_t messageIndex, ExceptionTracker& exceptionTracker) const {
154 auto* message = getMessage(messageIndex, exceptionTracker);
155 if (message == nullptr) {
156 return BytesView();
157 }
158
159 VALDI_TRACE_META("Protobuf.encodeMessage", message->getDescriptor()->name());
160
161 // Encoding walks the message's descriptor and may trigger first-time lazy resolution
162 // of message types (e.g. for messages created/decoded without postprocess) from the
163 // shared pool, so it must be serialized against concurrent pool access.
164 auto factoryLocks = lockRetainedMessageFactories();
165
166 return message->encode(_includeAllFieldsDuringEncoding);
167}
168
169size_t ProtobufArena::fieldToMessageIndex(JSProtobufMessage& message,
170 Protobuf::Field& field,

Callers

nothing calls this directly

Calls 4

getDescriptorMethod · 0.80
nameMethod · 0.65
encodeMethod · 0.65
BytesViewClass · 0.50

Tested by

no test coverage detected