Bug 1382908 - Make TaskTracer build and run again. r=billm
authorMarkus Stange <mstange@themasta.com>
Mon, 24 Jul 2017 18:35:07 -0400
changeset 419607 e0dace2b0ab34355eb4ba4dbc5d379768465d7e9
parent 419606 67be9d4a6c2cb1f344cf6faa62702bf020ee940e
child 419608 50ef560f1f5692ffcd2ee38bbf05adb979c1e30e
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1382908
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382908 - Make TaskTracer build and run again. r=billm MozReview-Commit-ID: 8SqBWgOXc6H
ipc/chromium/src/base/message_loop.cc
tools/profiler/tasktracer/GeckoTaskTracer.h
tools/profiler/tasktracer/TracedTaskCommon.cpp
tools/profiler/tasktracer/TracedTaskCommon.h
--- a/ipc/chromium/src/base/message_loop.cc
+++ b/ipc/chromium/src/base/message_loop.cc
@@ -379,17 +379,17 @@ void MessageLoop::PostTask_Helper(alread
   }
 
   // Tasks should only be queued before or during the Run loop, not after.
   MOZ_ASSERT(!shutting_down_);
 
 #ifdef MOZ_TASK_TRACER
   nsCOMPtr<nsIRunnable> tracedTask = task;
   if (mozilla::tasktracer::IsStartLogging()) {
-    tracedTask = mozilla::tasktracer::CreateTracedRunnable(Move(task));
+    tracedTask = mozilla::tasktracer::CreateTracedRunnable(tracedTask.forget());
     (static_cast<mozilla::tasktracer::TracedRunnable*>(tracedTask.get()))->DispatchTask();
   }
   PendingTask pending_task(tracedTask.forget(), true);
 #else
   PendingTask pending_task(Move(task), true);
 #endif
 
   if (delay_ms > 0) {
--- a/tools/profiler/tasktracer/GeckoTaskTracer.h
+++ b/tools/profiler/tasktracer/GeckoTaskTracer.h
@@ -141,17 +141,17 @@ UniquePtr<nsTArray<nsCString>> GetLogged
 
 // Returns the timestamp when Task Tracer is enabled in this process.
 PRTime GetStartTime();
 
 /**
  * Internal functions.
  */
 
-already_AddRefed<Runnable>
+already_AddRefed<nsIRunnable>
 CreateTracedRunnable(already_AddRefed<nsIRunnable>&& 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
 // where nsThread and base::thread release themselves.
 void FreeTraceInfo();
 
 const char* GetJSLabelPrefix();
--- a/tools/profiler/tasktracer/TracedTaskCommon.cpp
+++ b/tools/profiler/tasktracer/TracedTaskCommon.cpp
@@ -90,16 +90,19 @@ TracedTaskCommon::ClearTLSTraceInfo()
   info->mCurTraceSourceId = 0;
   info->mCurTraceSourceType = SourceEventType::Unknown;
   info->mCurTaskId = 0;
 }
 
 /**
  * Implementation of class TracedRunnable.
  */
+
+NS_IMPL_ISUPPORTS(TracedRunnable, nsIRunnable);
+
 TracedRunnable::TracedRunnable(already_AddRefed<nsIRunnable>&& aOriginalObj)
   : TracedTaskCommon()
   , mOriginalObj(Move(aOriginalObj))
 {
   Init();
   LogVirtualTablePtr(mTaskId, mSourceEventId, *reinterpret_cast<uintptr_t**>(mOriginalObj.get()));
 }
 
@@ -118,20 +121,20 @@ TracedRunnable::Run()
 
   return rv;
 }
 
 /**
  * CreateTracedRunnable() returns a TracedRunnable wrapping the original
  * nsIRunnable object, aRunnable.
  */
-already_AddRefed<Runnable>
+already_AddRefed<nsIRunnable>
 CreateTracedRunnable(already_AddRefed<nsIRunnable>&& aRunnable)
 {
-  RefPtr<Runnable> runnable = new TracedRunnable(Move(aRunnable));
+  RefPtr<nsIRunnable> runnable = new TracedRunnable(Move(aRunnable));
   return runnable.forget();
 }
 
 void
 VirtualTask::AutoRunTask::StartScope(VirtualTask* aTask)
 {
   mTask->SetTLSTraceInfo();
   LogBegin(mTask->mTaskId, mTask->mSourceEventId);
--- a/tools/profiler/tasktracer/TracedTaskCommon.h
+++ b/tools/profiler/tasktracer/TracedTaskCommon.h
@@ -53,19 +53,20 @@ protected:
   SourceEventType mSourceEventType;
   uint64_t mSourceEventId;
   uint64_t mParentTaskId;
   uint64_t mTaskId;
   bool mIsTraceInfoInit;
 };
 
 class TracedRunnable : public TracedTaskCommon
-                     , public Runnable
+                     , public nsIRunnable
 {
 public:
+  NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSIRUNNABLE
 
   explicit TracedRunnable(already_AddRefed<nsIRunnable>&& aOriginalObj);
 
 private:
   virtual ~TracedRunnable();
 
   nsCOMPtr<nsIRunnable> mOriginalObj;