From 542124682477385c26a1358ebebe665661478ddb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29?= Date: Thu, 13 Nov 2014 16:57:11 +0800 Subject: [PATCH] Bug 1097577 - CreateFakeTracedTask should return a already_AddRefed. r=thinker --- tools/profiler/GeckoTaskTracer.h | 2 +- tools/profiler/TracedTaskCommon.cpp | 4 ++-- tools/profiler/TracedTaskCommon.h | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/profiler/GeckoTaskTracer.h b/tools/profiler/GeckoTaskTracer.h index a51ca9adb17d..a429e4810f21 100644 --- a/tools/profiler/GeckoTaskTracer.h +++ b/tools/profiler/GeckoTaskTracer.h @@ -76,7 +76,7 @@ Task* CreateTracedTask(Task* aTask); already_AddRefed CreateTracedRunnable(nsIRunnable* aRunnable); -FakeTracedTask* CreateFakeTracedTask(int* aVptr); +already_AddRefed CreateFakeTracedTask(int* aVptr); // Free the TraceInfo allocated on a thread's TLS. Currently we are wrapping // tasks running on nsThreads and base::thread, so FreeTraceInfo is called at diff --git a/tools/profiler/TracedTaskCommon.cpp b/tools/profiler/TracedTaskCommon.cpp index 32c98e1c4b15..051049285009 100644 --- a/tools/profiler/TracedTaskCommon.cpp +++ b/tools/profiler/TracedTaskCommon.cpp @@ -162,10 +162,10 @@ CreateTracedTask(Task* aTask) * CreateFakeTracedTask() returns a FakeTracedTask tracking the event which is * not dispatched from its parent task directly, such as timer events. */ -FakeTracedTask* +already_AddRefed CreateFakeTracedTask(int* aVptr) { - nsAutoPtr task(new FakeTracedTask(aVptr)); + nsRefPtr task(new FakeTracedTask(aVptr)); return task.forget(); } diff --git a/tools/profiler/TracedTaskCommon.h b/tools/profiler/TracedTaskCommon.h index 7291ff78223c..5e85a30389c6 100644 --- a/tools/profiler/TracedTaskCommon.h +++ b/tools/profiler/TracedTaskCommon.h @@ -81,6 +81,8 @@ public: void BeginFakeTracedTask(); void EndFakeTracedTask(); private: + virtual ~FakeTracedTask() {} + // No copy allowed. FakeTracedTask() MOZ_DELETE; FakeTracedTask(const FakeTracedTask& aTask) MOZ_DELETE;