198 {
199
200
201 auto baseTypeResolver = &(serializationState->fBaseTypeResolver);
203 SkASSERT(
nullptr == baseTypeResolver->find(traceEvent->fID));
204 baseTypeResolver->set(traceEvent->fID, traceEvent->fName);
206 SkASSERT(
nullptr != baseTypeResolver->find(traceEvent->fID));
207 baseTypeResolver->remove(traceEvent->fID);
208 }
209
211
214 if (0 != traceEvent->fID) {
215
216 writer->
appendPointer(
"id",
reinterpret_cast<void*
>(traceEvent->fID));
217 }
218
219
220
221 uint64_t relativeTimestamp =
222 static_cast<int64_t>(traceEvent->fClockBegin - serializationState->fClockOffset);
223 writer->
appendDouble(
"ts",
static_cast<double>(relativeTimestamp) * 1
E-3);
224 if (0 != traceEvent->fClockEnd) {
225 double dur =
static_cast<double>(traceEvent->fClockEnd - traceEvent->fClockBegin) * 1
E-3;
227 }
228
229 writer->
appendS64(
"tid", serializationState->getShortThreadID(traceEvent->fThreadID));
230
231
233
234 if (traceEvent->fNumArgs) {
236 const char* stringTable = traceEvent->stringTable();
237 bool addedSnapshot = false;
239 baseTypeResolver->find(traceEvent->fID) &&
240 0 != strcmp(*baseTypeResolver->find(traceEvent->fID), traceEvent->fName)) {
241
243 writer->
appendCString(
"base_type", *baseTypeResolver->find(traceEvent->fID));
244 addedSnapshot = true;
245 }
246
247 for (
int i = 0;
i < traceEvent->fNumArgs; ++
i) {
248 const TraceEventArg* arg = traceEvent->args() +
i;
249
251
252 if (arg->fArgName && '#' == arg->fArgName[0]) {
257 } else {
259 }
260 }
261
262 if (addedSnapshot) {
264 }
265
267 }
268
270}
static void trace_value_to_json(SkJSONWriter *writer, uint64_t argValue, uint8_t argType, const char *stringTableBase)
#define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT
#define TRACE_EVENT_PHASE_CREATE_OBJECT
#define TRACE_EVENT_PHASE_DELETE_OBJECT
void appendS32(int32_t value)
void appendDouble(double value)
void beginObject(const char *name=nullptr, bool multiline=true)
void appendPointer(const void *value)
void appendS64(int64_t value)
void appendName(const char *name)
void appendCString(const char *value)
void appendString(const char *value, size_t size)