MCPcopy Create free account
hub / github.com/Tencent/libpag / ReadPerformanceData

Method ReadPerformanceData

src/codec/Codec.cpp:258–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258std::shared_ptr<PerformanceData> Codec::ReadPerformanceData(const void* bytes,
259 uint32_t byteLength) {
260 CodecContext context = {};
261 DecodeStream stream(&context, reinterpret_cast<const uint8_t*>(bytes), byteLength);
262 auto bodyBytes = ReadBodyBytes(&stream);
263 if (context.hasException()) {
264 return nullptr;
265 }
266 auto header = ReadTagHeader(&bodyBytes);
267 if (context.hasException()) {
268 return nullptr;
269 }
270
271 while (header.code != TagCode::End) {
272 auto tagBytes = bodyBytes.readBytes(header.length);
273 if (header.code == TagCode::Performance) {
274 auto data = std::shared_ptr<PerformanceData>(new PerformanceData());
275 ReadPerformanceTag(&tagBytes, data.get());
276 return data;
277 }
278 header = ReadTagHeader(&bodyBytes);
279 if (context.hasException()) {
280 return nullptr;
281 }
282 }
283 return nullptr;
284}
285
286void Codec::UpdateFileAttributes(std::shared_ptr<File> file, CodecContext* context,
287 const std::string& filePath) {

Callers

nothing calls this directly

Calls 6

ReadBodyBytesFunction · 0.85
ReadTagHeaderFunction · 0.85
ReadPerformanceTagFunction · 0.85
hasExceptionMethod · 0.80
readBytesMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected