forked from mirrors/gecko-dev
Bug 1319682 - fix compile warning/error in TaskTracer, r=sinker
MozReview-Commit-ID: 4E0ThIAZAxC --HG-- extra : rebase_source : d1cb4ae28e7d10b5bdd3d87d6a97413e2d204057
This commit is contained in:
parent
ced4cccc2c
commit
1de6877d89
4 changed files with 20 additions and 10 deletions
|
|
@ -16,10 +16,16 @@
|
|||
|
||||
#include "nsString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "platform.h"
|
||||
#include "prtime.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
#define getpid GetCurrentProcessId
|
||||
#endif
|
||||
|
||||
#define MAX_SIZE_LOG (1024 * 128)
|
||||
|
||||
// NS_ENSURE_TRUE_VOID() without the warning on the debug build.
|
||||
|
|
@ -181,7 +187,11 @@ InitTaskTracer(uint32_t aFlags)
|
|||
|
||||
MOZ_ASSERT(!sTraceInfos);
|
||||
|
||||
sTraceInfoTLS.init();
|
||||
bool success = sTraceInfoTLS.init();
|
||||
if (!success) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
// A memory barrier is necessary here.
|
||||
sTraceInfos = new nsTArray<UniquePtr<TraceInfo>>();
|
||||
}
|
||||
|
|
@ -225,7 +235,7 @@ GetOrCreateTraceInfo()
|
|||
}
|
||||
|
||||
if (!info) {
|
||||
info = AllocTraceInfo(gettid());
|
||||
info = AllocTraceInfo(Thread::GetCurrentId());
|
||||
sTraceInfoTLS.set(info);
|
||||
}
|
||||
|
||||
|
|
@ -238,7 +248,7 @@ GenNewUniqueTaskId()
|
|||
TraceInfo* info = GetOrCreateTraceInfo();
|
||||
ENSURE_TRUE(info, 0);
|
||||
|
||||
pid_t tid = gettid();
|
||||
Thread::tid_t tid = Thread::GetCurrentId();
|
||||
uint64_t taskid = ((uint64_t)tid << 32) | ++info->mLastUniqueTaskId;
|
||||
return taskid;
|
||||
}
|
||||
|
|
@ -325,7 +335,7 @@ LogBegin(uint64_t aTaskId, uint64_t aSourceEventId)
|
|||
log->mBegin.mTaskId = aTaskId;
|
||||
log->mBegin.mTime = GetTimestamp();
|
||||
log->mBegin.mPid = getpid();
|
||||
log->mBegin.mTid = gettid();
|
||||
log->mBegin.mTid = Thread::GetCurrentId();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -479,7 +489,7 @@ GetLoggedData(TimeStamp aTimeStamp)
|
|||
return result;
|
||||
}
|
||||
|
||||
const PRTime
|
||||
PRTime
|
||||
GetStartTime()
|
||||
{
|
||||
return sStartTime;
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public:
|
|||
class AutoSourceEvent : public AutoSaveCurTraceInfo
|
||||
{
|
||||
public:
|
||||
AutoSourceEvent(SourceEventType aType);
|
||||
explicit AutoSourceEvent(SourceEventType aType);
|
||||
~AutoSourceEvent();
|
||||
};
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ void StopLogging();
|
|||
UniquePtr<nsTArray<nsCString>> GetLoggedData(TimeStamp aStartTime);
|
||||
|
||||
// Returns the timestamp when Task Tracer is enabled in this process.
|
||||
const PRTime GetStartTime();
|
||||
PRTime GetStartTime();
|
||||
|
||||
/**
|
||||
* Internal functions.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ struct TraceInfoLogNode {
|
|||
|
||||
struct TraceInfo
|
||||
{
|
||||
TraceInfo(uint32_t aThreadId)
|
||||
explicit TraceInfo(uint32_t aThreadId)
|
||||
: mCurTraceSourceId(0)
|
||||
, mCurTaskId(0)
|
||||
, mCurTraceSourceType(Unknown)
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class TracedRunnable : public TracedTaskCommon
|
|||
public:
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
TracedRunnable(already_AddRefed<nsIRunnable>&& aOriginalObj);
|
||||
explicit TracedRunnable(already_AddRefed<nsIRunnable>&& aOriginalObj);
|
||||
|
||||
private:
|
||||
virtual ~TracedRunnable();
|
||||
|
|
@ -95,7 +95,7 @@ public:
|
|||
class AutoRunTask : public AutoSaveCurTraceInfo {
|
||||
VirtualTask* mTask;
|
||||
public:
|
||||
AutoRunTask(VirtualTask *aTask);
|
||||
explicit AutoRunTask(VirtualTask *aTask);
|
||||
~AutoRunTask();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue