Bug 815671 part 2. Make some content code use array references instead of array objects with implicit copies. r=smaug

This commit is contained in:
Boris Zbarsky 2012-11-29 11:14:13 -05:00
parent cad609114a
commit 6fa18e5571
3 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,7 @@ public:
}
// Create as a blob
nsDOMMultipartFile(nsTArray<nsCOMPtr<nsIDOMBlob> > aBlobs,
nsDOMMultipartFile(nsTArray<nsCOMPtr<nsIDOMBlob> >& aBlobs,
const nsAString& aContentType)
: nsDOMFile(aContentType, UINT64_MAX),
mBlobs(aBlobs)

View File

@ -288,7 +288,7 @@ nsDOMTouchEvent::GetTouches(nsIDOMTouchList** aTouches)
if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
// for touchend events, remove any changed touches from the touches array
nsTArray<nsCOMPtr<nsIDOMTouch> > unchangedTouches;
nsTArray<nsCOMPtr<nsIDOMTouch> > touches = touchEvent->touches;
const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (!touches[i]->mChanged) {
unchangedTouches.AppendElement(touches[i]);
@ -314,7 +314,7 @@ nsDOMTouchEvent::GetTargetTouches(nsIDOMTouchList** aTargetTouches)
nsTArray<nsCOMPtr<nsIDOMTouch> > targetTouches;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
nsTArray<nsCOMPtr<nsIDOMTouch> > touches = touchEvent->touches;
const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
// for touchend/cancel events, don't append to the target list if this is a
// touch that is ending
@ -342,7 +342,7 @@ nsDOMTouchEvent::GetChangedTouches(nsIDOMTouchList** aChangedTouches)
nsTArray<nsCOMPtr<nsIDOMTouch> > changedTouches;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
nsTArray<nsCOMPtr<nsIDOMTouch> > touches = touchEvent->touches;
const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (touches[i]->mChanged) {
changedTouches.AppendElement(touches[i]);

View File

@ -452,7 +452,7 @@ nsHTMLFormElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
}
static void
MarkOrphans(const nsTArray<nsGenericHTMLFormElement*> aArray)
MarkOrphans(const nsTArray<nsGenericHTMLFormElement*>& aArray)
{
uint32_t length = aArray.Length();
for (uint32_t i = 0; i < length; ++i) {
@ -461,7 +461,8 @@ MarkOrphans(const nsTArray<nsGenericHTMLFormElement*> aArray)
}
static void
CollectOrphans(nsINode* aRemovalRoot, nsTArray<nsGenericHTMLFormElement*> aArray
CollectOrphans(nsINode* aRemovalRoot,
const nsTArray<nsGenericHTMLFormElement*>& aArray
#ifdef DEBUG
, nsIDOMHTMLFormElement* aThisForm
#endif