From cbc9fbb2bf8a3147a01a7725ac1ac681576f8131 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 3 Oct 2017 19:48:10 +1100 Subject: [PATCH] Bug 1403868 (part 2) - Tweak profiler_tracing(). r=mstange. This patch does the following. - Makes the TracingKind argument non-optional. - Puts the UniqueProfilerBacktrace argument last in the second variant. - Reorders AutoProfilerTracing to match the order of the profiler_tracing() declarations. --HG-- extra : rebase_source : 8e9acdaf777c642cd854570771a3f96da6d524d1 --- .../composite/LayerManagerComposite.cpp | 2 +- layout/base/nsLayoutUtils.cpp | 4 +-- tools/profiler/core/platform.cpp | 2 +- tools/profiler/public/GeckoProfiler.h | 28 +++++++++---------- tools/profiler/tests/gtest/GeckoProfiler.cpp | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 2091392055f0..5b91e6f6ac87 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -868,7 +868,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi } else if (profiler_feature_active(ProfilerFeature::LayersDump)) { std::stringstream ss; Dump(ss); - profiler_tracing("log", ss.str().c_str()); + profiler_tracing("log", ss.str().c_str(), TRACING_EVENT); } // Dump to LayerScope Viewer diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 819e86f1c64e..fb7180e00c3c 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3804,7 +3804,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, // Flush stream now to avoid reordering dump output relative to // messages dumped by PaintRoot below. if (profilerNeedsDisplayList && !consoleNeedsDisplayList) { - profiler_tracing("log", ss->str().c_str()); + profiler_tracing("log", ss->str().c_str(), TRACING_EVENT); } else { fprint_stderr(gfxUtils::sDumpPaintFile, *ss); } @@ -3877,7 +3877,7 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, } if (profilerNeedsDisplayList && !consoleNeedsDisplayList) { - profiler_tracing("log", ss->str().c_str()); + profiler_tracing("log", ss->str().c_str(), TRACING_EVENT); } else { fprint_stderr(gfxUtils::sDumpPaintFile, *ss); } diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 8f75789733b0..048f9a897987 100755 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -3252,7 +3252,7 @@ profiler_tracing(const char* aCategory, const char* aMarkerName, void profiler_tracing(const char* aCategory, const char* aMarkerName, - UniqueProfilerBacktrace aCause, TracingKind aKind) + TracingKind aKind, UniqueProfilerBacktrace aCause) { MOZ_RELEASE_ASSERT(CorePS::Exists()); diff --git a/tools/profiler/public/GeckoProfiler.h b/tools/profiler/public/GeckoProfiler.h index 88f72d8e5919..123cc00ccbf6 100644 --- a/tools/profiler/public/GeckoProfiler.h +++ b/tools/profiler/public/GeckoProfiler.h @@ -416,11 +416,11 @@ enum TracingKind { // inactive or in privacy mode. PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aMarkerName, - TracingKind aKind = TRACING_EVENT)) + TracingKind aKind)) PROFILER_FUNC_VOID(profiler_tracing(const char* aCategory, const char* aMarkerName, - UniqueProfilerBacktrace aCause, - TracingKind aKind = TRACING_EVENT)) + TracingKind aKind, + UniqueProfilerBacktrace aCause)) //--------------------------------------------------------------------------- // Output profiles @@ -590,17 +590,6 @@ public: class MOZ_RAII AutoProfilerTracing { public: - AutoProfilerTracing(const char* aCategory, const char* aMarkerName, - UniqueProfilerBacktrace aBacktrace - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : mCategory(aCategory) - , mMarkerName(aMarkerName) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - profiler_tracing(mCategory, mMarkerName, Move(aBacktrace), - TRACING_INTERVAL_START); - } - AutoProfilerTracing(const char* aCategory, const char* aMarkerName MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : mCategory(aCategory) @@ -610,6 +599,17 @@ public: profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START); } + AutoProfilerTracing(const char* aCategory, const char* aMarkerName, + UniqueProfilerBacktrace aBacktrace + MOZ_GUARD_OBJECT_NOTIFIER_PARAM) + : mCategory(aCategory) + , mMarkerName(aMarkerName) + { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_START, + Move(aBacktrace)); + } + ~AutoProfilerTracing() { profiler_tracing(mCategory, mMarkerName, TRACING_INTERVAL_END); diff --git a/tools/profiler/tests/gtest/GeckoProfiler.cpp b/tools/profiler/tests/gtest/GeckoProfiler.cpp index dd0a853fe550..bb00f685a797 100644 --- a/tools/profiler/tests/gtest/GeckoProfiler.cpp +++ b/tools/profiler/tests/gtest/GeckoProfiler.cpp @@ -461,7 +461,7 @@ TEST(GeckoProfiler, Markers) profiler_tracing("A", "C", TRACING_INTERVAL_END); UniqueProfilerBacktrace bt = profiler_get_backtrace(); - profiler_tracing("B", "A", Move(bt), TRACING_EVENT); + profiler_tracing("B", "A", TRACING_EVENT, Move(bt)); { AutoProfilerTracing tracing("C", "A");