Bug 815671 part 4. Remove some array copying in gfx code. r=roc

This commit is contained in:
Boris Zbarsky 2012-11-29 11:14:13 -05:00
parent f1adcafb81
commit 4adc2730f3
4 changed files with 9 additions and 8 deletions

View File

@ -2173,7 +2173,8 @@ nsDOMWindowUtils::StopFrameTimeRecording(uint32_t *frameCount, float **frames)
if (!mgr)
return NS_ERROR_FAILURE;
nsTArray<float> frameTimes = mgr->StopFrameTimeRecording();
nsTArray<float> frameTimes;
mgr->StopFrameTimeRecording(frameTimes);
*frames = nullptr;
*frameCount = frameTimes.Length();

View File

@ -196,7 +196,7 @@ static void DumpLayerList(nsTArray<Layer*>& aLayers)
static void DumpEdgeList(DirectedGraph<Layer*>& aGraph)
{
nsTArray<DirectedGraph<Layer*>::Edge> edges = aGraph.GetEdgeList();
const nsTArray<DirectedGraph<Layer*>::Edge>& edges = aGraph.GetEdgeList();
for (uint32_t i = 0; i < edges.Length(); i++) {
fprintf(stderr, "From: ");

View File

@ -446,7 +446,8 @@ Layer::SetAnimations(const AnimationArray& aAnimations)
for (uint32_t i = 0; i < mAnimations.Length(); i++) {
AnimData* data = mAnimationData.AppendElement();
InfallibleTArray<css::ComputedTimingFunction*>& functions = data->mFunctions;
nsTArray<AnimationSegment> segments = mAnimations.ElementAt(i).segments();
const InfallibleTArray<AnimationSegment>& segments =
mAnimations.ElementAt(i).segments();
for (uint32_t j = 0; j < segments.Length(); j++) {
TimingFunction tf = segments.ElementAt(j).sampleFn();
css::ComputedTimingFunction* ctf = new css::ComputedTimingFunction();
@ -884,13 +885,12 @@ LayerManager::PostPresent()
}
}
nsTArray<float>
LayerManager::StopFrameTimeRecording()
void
LayerManager::StopFrameTimeRecording(nsTArray<float>& aTimes)
{
mLastFrameTime = TimeStamp();
nsTArray<float> result = mFrameTimes;
aTimes.SwapElements(mFrameTimes);
mFrameTimes.Clear();
return result;
}
void

View File

@ -482,7 +482,7 @@ public:
void LogSelf(const char* aPrefix="");
void StartFrameTimeRecording();
nsTArray<float> StopFrameTimeRecording();
void StopFrameTimeRecording(nsTArray<float>& aTimes);
void PostPresent();