From 0a4031e946ad338e910293fd1a9f902f604aa0e9 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Fri, 20 May 2016 09:09:33 +0900 Subject: [PATCH] Bug 1263486 part 2 - Use nsCSSValue move assignment operator in nsCSSValue::Adopt(Pair)ListValue r=heycam MozReview-Commit-ID: 2fTFNmtHxIP --HG-- extra : rebase_source : b9ed5d5a19488a7d5a6b8b48a52e8619672c945b --- layout/style/nsCSSValue.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index e7f477e046f7..03cc26f53eab 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -11,6 +11,7 @@ #include "mozilla/CSSStyleSheet.h" #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" +#include "mozilla/Move.h" #include "mozilla/css/ImageLoader.h" #include "CSSCalc.h" #include "gfxFontConstants.h" @@ -640,9 +641,7 @@ nsCSSValue::AdoptListValue(UniquePtr aValue) // We have to copy the first element since for owned lists the first // element should be an nsCSSValueList_heap object. SetListValue(); - // FIXME: If nsCSSValue gets a swap method or move assignment operator, - // we should use that here to avoid allocating an extra value. - mValue.mList->mValue = aValue->mValue; + mValue.mList->mValue = Move(aValue->mValue); mValue.mList->mNext = aValue->mNext; aValue->mNext = nullptr; aValue.reset(); @@ -672,10 +671,8 @@ nsCSSValue::AdoptPairListValue(UniquePtr aValue) // We have to copy the first element, since for owned pair lists, the first // element should be an nsCSSValuePairList_heap object. SetPairListValue(); - // FIXME: If nsCSSValue gets a swap method or move assignment operator, - // we should use that here to avoid allocating extra values. - mValue.mPairList->mXValue = aValue->mXValue; - mValue.mPairList->mYValue = aValue->mYValue; + mValue.mPairList->mXValue = Move(aValue->mXValue); + mValue.mPairList->mYValue = Move(aValue->mYValue); mValue.mPairList->mNext = aValue->mNext; aValue->mNext = nullptr; aValue.reset();