void TracedTaskCommon::Init() { TraceInfo* info = GetOrCreateTraceInfo(); NS_ENSURE_TRUE_VOID(info); mTaskId = GenNewUniqueTaskId(); mSourceEventId = info->mCurTraceSourceId; mSourceEventType = info->mCurTraceSourceType; LogDispatch(mTaskId, info->mCurTaskId, mSourceEventId, mSourceEventType); }
static void CreateSourceEvent(SourceEventType aType) { // Save the currently traced source event info. SaveCurTraceInfo(); // Create a new unique task id. uint64_t newId = GenNewUniqueTaskId(); TraceInfo* info = GetOrCreateTraceInfo(); ENSURE_TRUE_VOID(info); info->mCurTraceSourceId = newId; info->mCurTraceSourceType = aType; info->mCurTaskId = newId; uintptr_t* namePtr; #define SOURCE_EVENT_NAME(type) \ case SourceEventType::type: \ { \ static int CreateSourceEvent##type; \ namePtr = (uintptr_t*)&CreateSourceEvent##type; \ break; \ } switch (aType) { #include "SourceEventTypeMap.h" default: MOZ_CRASH("Unknown SourceEvent."); } #undef CREATE_SOURCE_EVENT_NAME // Log a fake dispatch and start for this source event. LogDispatch(newId, newId, newId, aType); LogVirtualTablePtr(newId, newId, namePtr); LogBegin(newId, newId); }
void TracedTaskCommon::DispatchTask(int aDelayTimeMs) { LogDispatch(mTaskId, mParentTaskId, mSourceEventId, mSourceEventType, aDelayTimeMs); }
void LogDispatch(uint64_t aTaskId, uint64_t aParentTaskId, uint64_t aSourceEventId, SourceEventType aSourceEventType) { LogDispatch(aTaskId, aParentTaskId, aSourceEventId, aSourceEventType, 0); }