diff --git a/tools/profiler/tasktracer/GeckoTaskTracer.h b/tools/profiler/tasktracer/GeckoTaskTracer.h index acb00e2af01..656513645c0 100644 --- a/tools/profiler/tasktracer/GeckoTaskTracer.h +++ b/tools/profiler/tasktracer/GeckoTaskTracer.h @@ -75,7 +75,8 @@ const PRTime GetStartTime(); Task* CreateTracedTask(Task* aTask); -already_AddRefed CreateTracedRunnable(nsIRunnable* aRunnable); +already_AddRefed +CreateTracedRunnable(already_AddRefed&& aRunnable); // 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/tasktracer/TracedTaskCommon.cpp b/tools/profiler/tasktracer/TracedTaskCommon.cpp index 1794d2e7804..9fc2f559a50 100644 --- a/tools/profiler/tasktracer/TracedTaskCommon.cpp +++ b/tools/profiler/tasktracer/TracedTaskCommon.cpp @@ -90,9 +90,9 @@ TracedTaskCommon::ClearTLSTraceInfo() /** * Implementation of class TracedRunnable. */ -TracedRunnable::TracedRunnable(nsIRunnable* aOriginalObj) +TracedRunnable::TracedRunnable(already_AddRefed&& aOriginalObj) : TracedTaskCommon() - , mOriginalObj(aOriginalObj) + , mOriginalObj(Move(aOriginalObj)) { Init(); LogVirtualTablePtr(mTaskId, mSourceEventId, *(int**)(aOriginalObj)); @@ -148,9 +148,9 @@ TracedTask::Run() * nsIRunnable object, aRunnable. */ already_AddRefed -CreateTracedRunnable(nsIRunnable* aRunnable) +CreateTracedRunnable(already_AddRefed&& aRunnable) { - nsCOMPtr runnable = new TracedRunnable(aRunnable); + nsCOMPtr runnable = new TracedRunnable(Move(aRunnable)); return runnable.forget(); } diff --git a/tools/profiler/tasktracer/TracedTaskCommon.h b/tools/profiler/tasktracer/TracedTaskCommon.h index b3c5fae0330..3594b8e9e95 100644 --- a/tools/profiler/tasktracer/TracedTaskCommon.h +++ b/tools/profiler/tasktracer/TracedTaskCommon.h @@ -46,7 +46,7 @@ class TracedRunnable : public TracedTaskCommon public: NS_DECL_NSIRUNNABLE - TracedRunnable(nsIRunnable* aOriginalObj); + TracedRunnable(already_AddRefed&& aOriginalObj); private: virtual ~TracedRunnable(); diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index f876ea770e3..7dc5f286af7 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -592,7 +592,7 @@ nsThread::DispatchInternal(already_AddRefed&& aEvent, uint32_t aFla } #ifdef MOZ_TASK_TRACER - nsCOMPtr tracedRunnable = CreateTracedRunnable(event); // adds a ref + nsCOMPtr tracedRunnable = CreateTracedRunnable(event.forget()); (static_cast(tracedRunnable.get()))->DispatchTask(); event = tracedRunnable.forget(); #endif