Bug 1237343 - Replace uses of mozilla::Vector with nsTArray. r=botond

MozReview-Commit-ID: BBLWj3GJ3dE

--HG--
extra : rebase_source : 2c52ac944da8c1e3c6d4bb768bc3a672f3e80918
This commit is contained in:
Kartikaya Gupta 2016-04-15 06:41:25 -04:00
parent 5eb5cc7d6c
commit ec856624f4
4 changed files with 25 additions and 30 deletions

View File

@ -19,7 +19,6 @@
#include "mozilla/layers/TouchCounter.h"// for TouchCounter
#include "mozilla/Mutex.h" // for Mutex
#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp
#include "mozilla/Vector.h" // for mozilla::Vector
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc

View File

@ -10,9 +10,9 @@
#include "base/message_loop.h"
#include "mozilla/RefPtr.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Vector.h"
#include "FrameMetrics.h"
#include "nsISupportsImpl.h"
#include "nsTArray.h"
namespace mozilla {
namespace layers {
@ -46,7 +46,7 @@ public:
* Get the deferred tasks in |mDeferredTasks| and place them in |aTasks|. See
* |mDeferredTasks| for more information. Clears |mDeferredTasks|.
*/
Vector<Task*> TakeDeferredTasks() {
nsTArray<Task*> TakeDeferredTasks() {
return Move(mDeferredTasks);
}
@ -71,7 +71,7 @@ protected:
* Derived classes can add tasks here in Sample(), and the APZC can call
* ExecuteDeferredTasks() to execute them.
*/
Vector<Task*> mDeferredTasks;
nsTArray<Task*> mDeferredTasks;
};
} // namespace layers

View File

@ -516,11 +516,10 @@ public:
// while holding mMonitor, because otherwise, if the overscrolled APZC
// is this one, then the SetState(NOTHING) in UpdateAnimation will
// stomp on the SetState(SNAP_BACK) it does.
if (!mDeferredTasks.append(NewRunnableMethod(mOverscrollHandoffChain.get(),
mDeferredTasks.AppendElement(
NewRunnableMethod(mOverscrollHandoffChain.get(),
&OverscrollHandoffChain::SnapBackOverscrolledApzc,
&mApzc))) {
MOZ_CRASH();
}
&mApzc));
return false;
}
@ -569,13 +568,12 @@ public:
// the lock ordering. Instead we schedule HandleFlingOverscroll() to be
// called after mMonitor is released.
APZC_LOG("%p fling went into overscroll, handing off with velocity %s\n", &mApzc, Stringify(velocity).c_str());
if (!mDeferredTasks.append(NewRunnableMethod(&mApzc,
mDeferredTasks.AppendElement(
NewRunnableMethod(&mApzc,
&AsyncPanZoomController::HandleFlingOverscroll,
velocity,
mOverscrollHandoffChain,
mScrolledApzc))) {
MOZ_CRASH();
}
mScrolledApzc));
// If there is a remaining velocity on this APZC, continue this fling
// as well. (This fling and the handed-off fling will run concurrently.)
@ -703,10 +701,9 @@ public:
// The scroll snapping is done in a deferred task, otherwise the state
// change to NOTHING caused by the overscroll animation ending would
// clobber a possible state change to SMOOTH_SCROLL in ScrollSnap().
if (!mDeferredTasks.append(NewRunnableMethod(&mApzc,
&AsyncPanZoomController::ScrollSnap))) {
MOZ_CRASH();
}
mDeferredTasks.AppendElement(
NewRunnableMethod(&mApzc,
&AsyncPanZoomController::ScrollSnap));
return false;
}
return true;
@ -822,12 +819,10 @@ public:
// HandleSmoothScrollOverscroll() (which acquires the tree lock) would violate
// the lock ordering. Instead we schedule HandleSmoothScrollOverscroll() to be
// called after mMonitor is released.
if (!mDeferredTasks.append(NewRunnableMethod(&mApzc,
mDeferredTasks.AppendElement(
NewRunnableMethod(&mApzc,
&AsyncPanZoomController::HandleSmoothScrollOverscroll,
velocity))) {
MOZ_CRASH();
}
velocity));
return false;
}
@ -3065,7 +3060,7 @@ AsyncPanZoomController::RequestContentRepaint(const FrameMetrics& aFrameMetrics,
}
bool AsyncPanZoomController::UpdateAnimation(const TimeStamp& aSampleTime,
Vector<Task*>* aOutDeferredTasks)
nsTArray<Task*>* aOutDeferredTasks)
{
APZThreadUtils::AssertOnCompositorThread();
@ -3166,7 +3161,7 @@ bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
// responsibility to schedule a composite.
mAsyncTransformAppliedToContent = false;
bool requestAnimationFrame = false;
Vector<Task*> deferredTasks;
nsTArray<Task*> deferredTasks;
{
ReentrantMonitorAutoEnter lock(mMonitor);
@ -3188,7 +3183,7 @@ bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
// UpdateAnimation()). This needs to be done after the monitor is released
// since the tasks are allowed to call APZCTreeManager methods which can grab
// the tree lock.
for (uint32_t i = 0; i < deferredTasks.length(); ++i) {
for (uint32_t i = 0; i < deferredTasks.Length(); ++i) {
deferredTasks[i]->Run();
delete deferredTasks[i];
}

View File

@ -27,6 +27,7 @@
#include "mozilla/gfx/Matrix.h"
#include "nsIScrollableFrame.h"
#include "nsRegion.h"
#include "nsTArray.h"
#include "PotentialCheckerboardDurationTracker.h"
#include "base/message_loop.h"
@ -161,7 +162,7 @@ public:
bool AdvanceAnimations(const TimeStamp& aSampleTime);
bool UpdateAnimation(const TimeStamp& aSampleTime,
Vector<Task*>* aOutDeferredTasks);
nsTArray<Task*>* aOutDeferredTasks);
/**
* A shadow layer update has arrived. |aScrollMetdata| is the new ScrollMetadata