Bug 1351528 (part 2) - Rename TracingMetadata as TracingKind. r=mstange.

"Metadata" regularly confuses me, because it suggests something complicated
rather than a simple enum.

This change also has the benefit of removing inconsistent capitalization
("Metadata" vs. "MetaData").

--HG--
extra : rebase_source : b651e124142c8d93139d22dae1c993c899be4d7a
This commit is contained in:
Nicholas Nethercote 2017-03-29 13:56:14 +11:00
Родитель 4285c8907d
Коммит 2a3ba6e9fa
5 изменённых файлов: 20 добавлений и 18 удалений

Просмотреть файл

@ -50,16 +50,18 @@ ProfilerMarkerPayload::streamCommonProps(const char* aMarkerType,
}
}
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData)
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory,
TracingKind aKind)
: mCategory(aCategory)
, mMetaData(aMetaData)
, mKind(aKind)
{
}
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData,
ProfilerMarkerTracing::ProfilerMarkerTracing(const char* aCategory,
TracingKind aKind,
UniqueProfilerBacktrace aCause)
: mCategory(aCategory)
, mMetaData(aMetaData)
, mKind(aKind)
{
if (aCause) {
SetStack(mozilla::Move(aCause));
@ -77,9 +79,9 @@ ProfilerMarkerTracing::StreamPayload(SpliceableJSONWriter& aWriter,
aWriter.StringProperty("category", GetCategory());
}
if (GetMetaData() == TRACING_INTERVAL_START) {
if (GetKind() == TRACING_INTERVAL_START) {
aWriter.StringProperty("interval", "start");
} else if (GetMetaData() == TRACING_INTERVAL_END) {
} else if (GetKind() == TRACING_INTERVAL_END) {
aWriter.StringProperty("interval", "end");
}
}

Просмотреть файл

@ -3064,7 +3064,7 @@ profiler_add_marker(const char* aMarker, ProfilerMarkerPayload* aPayload)
void
profiler_tracing(const char* aCategory, const char* aInfo,
TracingMetadata aMetaData)
TracingKind aKind)
{
// This function runs both on and off the main thread.
@ -3076,13 +3076,13 @@ profiler_tracing(const char* aCategory, const char* aInfo,
return;
}
auto marker = new ProfilerMarkerTracing(aCategory, aMetaData);
auto marker = new ProfilerMarkerTracing(aCategory, aKind);
locked_profiler_add_marker(lock, aInfo, marker);
}
void
profiler_tracing(const char* aCategory, const char* aInfo,
UniqueProfilerBacktrace aCause, TracingMetadata aMetaData)
UniqueProfilerBacktrace aCause, TracingKind aKind)
{
// This function runs both on and off the main thread.
@ -3095,7 +3095,7 @@ profiler_tracing(const char* aCategory, const char* aInfo,
}
auto marker =
new ProfilerMarkerTracing(aCategory, aMetaData, mozilla::Move(aCause));
new ProfilerMarkerTracing(aCategory, aKind, mozilla::Move(aCause));
locked_profiler_add_marker(lock, aInfo, marker);
}

Просмотреть файл

@ -40,7 +40,7 @@ class Promise;
class nsIProfilerStartParams;
enum TracingMetadata {
enum TracingKind {
TRACING_EVENT,
TRACING_INTERVAL_START,
TRACING_INTERVAL_END,
@ -124,10 +124,10 @@ using UniqueProfilerBacktrace =
// Adds a tracing marker to the PseudoStack. A no-op if the profiler is
// inactive or in privacy mode.
PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aInfo,
TracingMetadata metaData = TRACING_EVENT))
TracingKind aKind = TRACING_EVENT))
PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aInfo,
UniqueProfilerBacktrace aCause,
TracingMetadata metaData = TRACING_EVENT))
TracingKind aKind = TRACING_EVENT))
// Initialize the profiler. If MOZ_PROFILER_STARTUP is set the profiler will be
// started. This call must happen before any other profiler calls (except

Просмотреть файл

@ -76,12 +76,12 @@ private:
class ProfilerMarkerTracing : public ProfilerMarkerPayload
{
public:
ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData);
ProfilerMarkerTracing(const char* aCategory, TracingMetadata aMetaData,
ProfilerMarkerTracing(const char* aCategory, TracingKind aKind);
ProfilerMarkerTracing(const char* aCategory, TracingKind aKind,
UniqueProfilerBacktrace aCause);
const char *GetCategory() const { return mCategory; }
TracingMetadata GetMetaData() const { return mMetaData; }
TracingKind GetKind() const { return mKind; }
virtual void StreamPayload(SpliceableJSONWriter& aWriter,
const mozilla::TimeStamp& aStartTime,
@ -89,7 +89,7 @@ public:
private:
const char *mCategory;
TracingMetadata mMetaData;
TracingKind mKind;
};
class ProfilerMarkerImagePayload : public ProfilerMarkerPayload

Просмотреть файл

@ -6,7 +6,7 @@
#include "gtest/gtest.h"
#include "mozilla/Atomics.h"
#include "LulMain.h"
#include "GeckoProfiler.h" // for TracingMetadata
#include "GeckoProfiler.h" // for TracingKind
#include "platform-linux-lul.h" // for read_procmaps
// Set this to 0 to make LUL be completely silent during tests.