Bug 685404. Make callers of nsDisplayList::HitTest use nsAutoTArrays to reduce allocations. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Thu, 08 Sep 2011 17:29:54 -0400
changeset 78095 aea08d37a22b31c294f6be561d2c8599b57b334b
parent 78094 a38ad346d7cba3d4c13eab623dfcf62b2459cf58
child 78096 077597e9accd846d364cb60881bef60e05f7b80d
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs685404
milestone9.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 685404. Make callers of nsDisplayList::HitTest use nsAutoTArrays to reduce allocations. r=tnikkel
content/base/src/nsDocument.cpp
layout/base/nsLayoutUtils.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -2873,17 +2873,17 @@ nsDocument::NodesFromRectHelper(float aX
   nsIPresShell *ps = GetShell();
   NS_ENSURE_STATE(ps);
   nsIFrame *rootFrame = ps->GetRootFrame();
 
   // XUL docs, unlike HTML, have no frame tree until everything's done loading
   if (!rootFrame)
     return NS_OK; // return nothing to premature XUL callers as a reminder to wait
 
-  nsTArray<nsIFrame*> outFrames;
+  nsAutoTArray<nsIFrame*,8> outFrames;
   nsLayoutUtils::GetFramesForArea(rootFrame, rect, outFrames,
                                   PR_TRUE, aIgnoreRootScrollFrame);
 
   PRInt32 length = outFrames.Length();
   if (!length)
     return NS_OK;
 
   // Used to filter out repeated elements in sequence.
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1292,31 +1292,31 @@ nsLayoutUtils::GetRemoteContentIds(nsIFr
   builder.EnterPresShell(aFrame, aTarget);
 
   nsresult rv =
     aFrame->BuildDisplayListForStackingContext(&builder, aTarget, &list);
 
   builder.LeavePresShell(aFrame, aTarget);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  nsTArray<nsIFrame*> outFrames;
+  nsAutoTArray<nsIFrame*,8> outFrames;
   nsDisplayItem::HitTestState hitTestState(&aOutIDs);
   list.HitTest(&builder, aTarget, &hitTestState, &outFrames);
   list.DeleteAll();
 
   return NS_OK;
 }
 
 nsIFrame*
 nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt,
                                 PRBool aShouldIgnoreSuppression,
                                 PRBool aIgnoreRootScrollFrame)
 {
   nsresult rv;
-  nsTArray<nsIFrame*> outFrames;
+  nsAutoTArray<nsIFrame*,8> outFrames;
   rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames,
                         aShouldIgnoreSuppression, aIgnoreRootScrollFrame);
   NS_ENSURE_SUCCESS(rv, nsnull);
   return outFrames.Length() ? outFrames.ElementAt(0) : nsnull;
 }
 
 nsresult
 nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,