Bug 1038727 - Convert APZ from nsAutoPtr to UniquePtr. r=kats
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 15 Jul 2014 13:44:37 -0400
changeset 215021 4530801b5e4603b50f14fc556395280f8ed748cf
parent 215020 df8c4d6994c6cd1e41b7d7e071573e593674eecf
child 215022 91a4d189f5d75a231be157f9be994b3b4b13f062
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1038727
milestone33.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 1038727 - Convert APZ from nsAutoPtr to UniquePtr. r=kats
browser/components/loop/content/shared/js/views.js
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/TaskThrottler.cpp
gfx/layers/apz/src/TaskThrottler.h
toolkit/webapps/tests/test_custom_origin.xul
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1945,19 +1945,19 @@ void AsyncPanZoomController::RequestCont
       fabsf(aFrameMetrics.mViewport.width - mLastPaintRequestMetrics.mViewport.width) < EPSILON &&
       fabsf(aFrameMetrics.mViewport.height - mLastPaintRequestMetrics.mViewport.height) < EPSILON) {
     return;
   }
 
   SendAsyncScrollEvent();
   mPaintThrottler.PostTask(
     FROM_HERE,
-    NewRunnableMethod(this,
+    UniquePtr<CancelableTask>(NewRunnableMethod(this,
                       &AsyncPanZoomController::DispatchRepaintRequest,
-                      aFrameMetrics),
+                      aFrameMetrics)),
     GetFrameTime());
 
   aFrameMetrics.SetPresShellId(mLastContentPaintMetrics.GetPresShellId());
   mLastPaintRequestMetrics = aFrameMetrics;
 }
 
 /*static*/ CSSRect
 GetDisplayPortRect(const FrameMetrics& aFrameMetrics)
--- a/gfx/layers/apz/src/TaskThrottler.cpp
+++ b/gfx/layers/apz/src/TaskThrottler.cpp
@@ -13,29 +13,28 @@ TaskThrottler::TaskThrottler(const TimeS
   : mOutstanding(false)
   , mQueuedTask(nullptr)
   , mStartTime(aTimeStamp)
   , mMean(1)
 { }
 
 void
 TaskThrottler::PostTask(const tracked_objects::Location& aLocation,
-                        CancelableTask* aTask, const TimeStamp& aTimeStamp)
+                        UniquePtr<CancelableTask> aTask, const TimeStamp& aTimeStamp)
 {
   aTask->SetBirthPlace(aLocation);
 
   if (mOutstanding) {
     if (mQueuedTask) {
       mQueuedTask->Cancel();
     }
-    mQueuedTask = aTask;
+    mQueuedTask = Move(aTask);
   } else {
     mStartTime = aTimeStamp;
     aTask->Run();
-    delete aTask;
     mOutstanding = true;
   }
 }
 
 void
 TaskThrottler::TaskComplete(const TimeStamp& aTimeStamp)
 {
   if (!mOutstanding) {
--- a/gfx/layers/apz/src/TaskThrottler.h
+++ b/gfx/layers/apz/src/TaskThrottler.h
@@ -7,17 +7,17 @@
 #ifndef mozilla_dom_TaskThrottler_h
 #define mozilla_dom_TaskThrottler_h
 
 #include <stdint.h>                     // for uint32_t
 #include "base/task.h"                  // for CancelableTask
 #include "mozilla/TimeStamp.h"          // for TimeDuration, TimeStamp
 #include "mozilla/RollingMean.h"        // for RollingMean
 #include "mozilla/mozalloc.h"           // for operator delete
-#include "nsAutoPtr.h"                  // for nsAutoPtr
+#include "mozilla/UniquePtr.h"          // for UniquePtr
 #include "nsTArray.h"                   // for nsTArray
 
 namespace tracked_objects {
 class Location;
 }
 
 namespace mozilla {
 namespace layers {
@@ -42,17 +42,17 @@ public:
   /** Post a task to be run as soon as there are no outstanding tasks.
    *
    * @param aLocation Use the macro FROM_HERE
    * @param aTask     Ownership of this object is transferred to TaskThrottler
    *                  which will delete it when it is either run or becomes
    *                  obsolete or the TaskThrottler is destructed.
    */
   void PostTask(const tracked_objects::Location& aLocation,
-                CancelableTask* aTask, const TimeStamp& aTimeStamp);
+                UniquePtr<CancelableTask> aTask, const TimeStamp& aTimeStamp);
   /**
    * Mark the task as complete and process the next queued task.
    */
   void TaskComplete(const TimeStamp& aTimeStamp);
 
   /**
    * Calculate the average time between processing the posted task and getting
    * the TaskComplete() call back.
@@ -85,17 +85,17 @@ public:
   {
     if (aMaxDurations != mMean.maxValues()) {
       mMean = RollingMean<TimeDuration, TimeDuration>(aMaxDurations);
     }
   }
 
 private:
   bool mOutstanding;
-  nsAutoPtr<CancelableTask> mQueuedTask;
+  UniquePtr<CancelableTask> mQueuedTask;
   TimeStamp mStartTime;
   RollingMean<TimeDuration, TimeDuration> mMean;
 };
 
 }
 }
 
 #endif // mozilla_dom_TaskThrottler_h