Bug 1483985 - use std::move to avoid a copy in a few places that clang recommends; r=froydnj
☠☠ backed out by 2417bdf57be2 ☠ ☠
authorAlex Gaynor <agaynor@mozilla.com>
Mon, 27 Aug 2018 15:06:58 +0000
changeset 488608 be4fd8ee7afd98b8e8f1cbffd2fc634fa5fe49a1
parent 488607 afeaf5a5abe3a232d7d7538528967568f651237d
child 488609 ca0f02aa22ea8a12765eeed8a7f337c3b5b1be2e
push id9734
push usershindli@mozilla.com
push dateThu, 30 Aug 2018 12:18:07 +0000
treeherdermozilla-beta@71c71ab3afae [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1483985
milestone63.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 1483985 - use std::move to avoid a copy in a few places that clang recommends; r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D3543
dom/storage/LocalStorageManager.cpp
gfx/thebes/gfxPlatform.cpp
layout/painting/DisplayItemClip.cpp
layout/painting/DisplayItemClipChain.cpp
layout/painting/nsDisplayList.cpp
toolkit/components/extensions/WebExtensionPolicy.cpp
toolkit/components/url-classifier/LookupCache.h
--- a/dom/storage/LocalStorageManager.cpp
+++ b/dom/storage/LocalStorageManager.cpp
@@ -137,17 +137,17 @@ LocalStorageManager::CreateOrigin(const 
   // Note: some hard-coded sqlite statements are dependent on the format this
   // method returns.  Changing this without updating those sqlite statements
   // will cause malfunction.
 
   nsAutoCString scope;
   scope.Append(aOriginSuffix);
   scope.Append(':');
   scope.Append(aOriginNoSuffix);
-  return scope;
+  return std::move(scope);
 }
 
 LocalStorageCache*
 LocalStorageManager::GetCache(const nsACString& aOriginSuffix,
                               const nsACString& aOriginNoSuffix)
 {
   CacheOriginHashtable* table = mCaches.LookupOrAdd(aOriginSuffix);
   LocalStorageCacheHashKey* entry = table->GetEntry(aOriginNoSuffix);
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1663,17 +1663,17 @@ gfxPlatform::GetDefaultFontName(const ns
     nsAutoString result;
 
     gfxFontFamily* fontFamily = gfxPlatformFontList::PlatformFontList()->
         GetDefaultFontFamily(aLangGroup, aGenericFamily);
     if (fontFamily) {
       fontFamily->LocalizedName(result);
     } // (else, leave 'result' empty)
 
-    return result;
+    return std::move(result);
 }
 
 bool
 gfxPlatform::DownloadableFontsEnabled()
 {
     if (mAllowDownloadableFonts == UNINITIALIZED_VALUE) {
         mAllowDownloadableFonts =
             Preferences::GetBool(GFX_DOWNLOADABLE_FONTS_ENABLED, false);
--- a/layout/painting/DisplayItemClip.cpp
+++ b/layout/painting/DisplayItemClip.cpp
@@ -540,17 +540,17 @@ DisplayItemClip::ToString() const
     for (uint32_t i = 0; i < mRoundedClipRects.Length(); ++i) {
       const RoundedRect& r = mRoundedClipRects[i];
       str.AppendPrintf(" [%d,%d,%d,%d corners %d,%d,%d,%d,%d,%d,%d,%d]",
                        r.mRect.x, r.mRect.y, r.mRect.width, r.mRect.height,
                        r.mRadii[0], r.mRadii[1], r.mRadii[2], r.mRadii[3],
                        r.mRadii[4], r.mRadii[5], r.mRadii[6], r.mRadii[7]);
     }
   }
-  return str;
+  return std::move(str);
 }
 
 void
 DisplayItemClip::ToComplexClipRegions(int32_t aAppUnitsPerDevPixel,
                                       const layers::StackingContextHelper& aSc,
                                       nsTArray<wr::ComplexClipRegion>& aOutArray) const
 {
   for (uint32_t i = 0; i < mRoundedClipRects.Length(); i++) {
--- a/layout/painting/DisplayItemClipChain.cpp
+++ b/layout/painting/DisplayItemClipChain.cpp
@@ -74,17 +74,17 @@ DisplayItemClipChain::ToString(const Dis
       str.AppendPrintf("0x%p <%s> [0x%p]", sc, sc->mClip.ToString().get(), sc->mASR->mScrollableFrame);
     } else {
       str.AppendPrintf("0x%p <%s> [root asr]", sc, sc->mClip.ToString().get());
     }
     if (sc->mParent) {
       str.AppendLiteral(", ");
     }
   }
-  return str;
+  return std::move(str);
 }
 
 bool
 DisplayItemClipChain::HasRoundedCorners() const
 {
   return mClip.GetRoundedRectCount() > 0 || (mParent && mParent->HasRoundedCorners());
 }
 
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -169,17 +169,17 @@ ActiveScrolledRoot::ToString(const Activ
 {
   nsAutoCString str;
   for (auto* asr = aActiveScrolledRoot; asr; asr = asr->mParent) {
     str.AppendPrintf("<0x%p>", asr->mScrollableFrame);
     if (asr->mParent) {
       str.AppendLiteral(", ");
     }
   }
-  return str;
+  return std::move(str);
 }
 
 static inline CSSAngle
 MakeCSSAngle(const nsCSSValue& aValue)
 {
   return CSSAngle(aValue.GetAngleValue(), aValue.GetUnit());
 }
 
--- a/toolkit/components/extensions/WebExtensionPolicy.cpp
+++ b/toolkit/components/extensions/WebExtensionPolicy.cpp
@@ -454,30 +454,30 @@ WebExtensionPolicy::IsRestrictedURI(cons
 
 nsCString
 WebExtensionPolicy::BackgroundPageHTML() const
 {
   nsAutoCString result;
 
   if (mBackgroundScripts.IsNull()) {
     result.SetIsVoid(true);
-    return result;
+    return std::move(result);
   }
 
   result.AppendLiteral(kBackgroundPageHTMLStart);
 
   for (auto& script : mBackgroundScripts.Value()) {
     nsCString escaped;
     nsAppendEscapedHTML(NS_ConvertUTF16toUTF8(script), escaped);
 
     result.AppendPrintf(kBackgroundPageHTMLScript, escaped.get());
   }
 
   result.AppendLiteral(kBackgroundPageHTMLEnd);
-  return result;
+  return std::move(result);
 }
 
 void
 WebExtensionPolicy::Localize(const nsAString& aInput, nsString& aOutput) const
 {
   mLocalizeCallback->Call(aInput, aOutput);
 }
 
--- a/toolkit/components/url-classifier/LookupCache.h
+++ b/toolkit/components/url-classifier/LookupCache.h
@@ -55,17 +55,17 @@ public:
     }
   }
 
   nsAutoCString PartialHashHex() const {
     nsAutoCString hex;
     for (size_t i = 0; i < mPartialHashLength; i++) {
       hex.AppendPrintf("%.2X", hash.complete.buf[i]);
     }
-    return hex;
+    return std::move(hex);
   }
 
   bool Confirmed() const { return mConfirmed || mProtocolConfirmed; }
 
   // True if we have a complete match for this hash in the table.
   bool Complete() const { return mPartialHashLength == COMPLETE_SIZE; }
 
   // True if this is a noise entry, i.e. an extra entry