Bug 999121 - Avoid mFramesMarkedForDisplay relloc with SetCapacity. r=mwoodrow
authorBenoit Girard <b56girard@gmail.com>
Mon, 21 Apr 2014 16:46:03 -0400
changeset 197962 9ac8dc04297e4d194d34f197d4261b203e4236ce
parent 197961 756d9a976d8568fa2e342ec6f4cc5285395630cb
child 197963 19c2a56d49c2f227d18e89dd80b80a36b86b5758
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwoodrow
bugs999121
milestone31.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 999121 - Avoid mFramesMarkedForDisplay relloc with SetCapacity. r=mwoodrow
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -933,16 +933,17 @@ nsDisplayListBuilder::ResetMarkedFramesF
   }
   mFramesMarkedForDisplay.SetLength(firstFrameForShell);
 }
 
 void
 nsDisplayListBuilder::MarkFramesForDisplayList(nsIFrame* aDirtyFrame,
                                                const nsFrameList& aFrames,
                                                const nsRect& aDirtyRect) {
+  mFramesMarkedForDisplay.SetCapacity(mFramesMarkedForDisplay.Length() + aFrames.GetLength());
   for (nsFrameList::Enumerator e(aFrames); !e.AtEnd(); e.Next()) {
     mFramesMarkedForDisplay.AppendElement(e.get());
     MarkOutOfFlowFrameForDisplay(aDirtyFrame, e.get(), aDirtyRect);
   }
 }
 
 void
 nsDisplayListBuilder::MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame, const nsRect& aDirtyRect)