From 2b38307221ac35a2bea69508e15c39df4134d45e Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Tue, 15 Jul 2014 13:44:37 -0400 Subject: [PATCH] Bug 1038727 - Convert APZ from nsAutoPtr to UniquePtr. r=kats --HG-- rename : browser/components/loop/content/shared/js/views.jsx => browser/components/loop/content/shared/js/views.js rename : toolkit/webapps/tests/test_custom_origin_uninstall_install.xul => toolkit/webapps/tests/test_custom_origin.xul extra : rebase_source : 2448597696cbf24512b54b6acbdfb52b71995dde --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 4 ++-- gfx/layers/apz/src/TaskThrottler.cpp | 5 ++--- gfx/layers/apz/src/TaskThrottler.h | 6 +++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 7fb1aa7a149b96..00f4f4b3b0fe5c 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1950,9 +1950,9 @@ void AsyncPanZoomController::RequestContentRepaint(FrameMetrics& aFrameMetrics) SendAsyncScrollEvent(); mPaintThrottler.PostTask( FROM_HERE, - NewRunnableMethod(this, + UniquePtr(NewRunnableMethod(this, &AsyncPanZoomController::DispatchRepaintRequest, - aFrameMetrics), + aFrameMetrics)), GetFrameTime()); aFrameMetrics.SetPresShellId(mLastContentPaintMetrics.GetPresShellId()); diff --git a/gfx/layers/apz/src/TaskThrottler.cpp b/gfx/layers/apz/src/TaskThrottler.cpp index 44e0e65f4e1c6e..93df266f0ed727 100644 --- a/gfx/layers/apz/src/TaskThrottler.cpp +++ b/gfx/layers/apz/src/TaskThrottler.cpp @@ -18,7 +18,7 @@ TaskThrottler::TaskThrottler(const TimeStamp& aTimeStamp) void TaskThrottler::PostTask(const tracked_objects::Location& aLocation, - CancelableTask* aTask, const TimeStamp& aTimeStamp) + UniquePtr aTask, const TimeStamp& aTimeStamp) { aTask->SetBirthPlace(aLocation); @@ -26,11 +26,10 @@ TaskThrottler::PostTask(const tracked_objects::Location& aLocation, if (mQueuedTask) { mQueuedTask->Cancel(); } - mQueuedTask = aTask; + mQueuedTask = Move(aTask); } else { mStartTime = aTimeStamp; aTask->Run(); - delete aTask; mOutstanding = true; } } diff --git a/gfx/layers/apz/src/TaskThrottler.h b/gfx/layers/apz/src/TaskThrottler.h index e060bdbaedcfba..606f09aeefc64f 100644 --- a/gfx/layers/apz/src/TaskThrottler.h +++ b/gfx/layers/apz/src/TaskThrottler.h @@ -12,7 +12,7 @@ #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 { @@ -47,7 +47,7 @@ class TaskThrottler { * obsolete or the TaskThrottler is destructed. */ void PostTask(const tracked_objects::Location& aLocation, - CancelableTask* aTask, const TimeStamp& aTimeStamp); + UniquePtr aTask, const TimeStamp& aTimeStamp); /** * Mark the task as complete and process the next queued task. */ @@ -90,7 +90,7 @@ class TaskThrottler { private: bool mOutstanding; - nsAutoPtr mQueuedTask; + UniquePtr mQueuedTask; TimeStamp mStartTime; RollingMean mMean; };