Bug 1261123 - don't needlessly construct nsAutoCString temporaries in nsDefaultURIFixup; r=smaug
authorNathan Froyd <froydnj.com>
Thu, 31 Mar 2016 13:16:07 -0400
changeset 291456 df803eb33993cc01ad0c43740a9e2a97fd976020
parent 291455 4c3640e00eefdca7693c4a0ffb097656404a8593
child 291474 55d557f4d73ee58664bdf2fa85aaab555224722e
child 291477 a28d0f76c03b1b6c823ac0bfdd99462dcf2962e9
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1261123
milestone48.0a1
Bug 1261123 - don't needlessly construct nsAutoCString temporaries in nsDefaultURIFixup; r=smaug We can make the non-virtual overload of IsDomainWhitelisted take an nsACString instead of an nsAutoCString and avoid some unnecessary copying.
docshell/base/nsDefaultURIFixup.cpp
docshell/base/nsDefaultURIFixup.h
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -1066,17 +1066,17 @@ nsDefaultURIFixup::KeywordURIFixup(const
     // host is not whitelisted, so we do a keyword search *anyway*:
     rv = TryKeywordFixupForURIInfo(aFixupInfo->mOriginalInput, aFixupInfo,
                                    aPostData);
   }
   return rv;
 }
 
 bool
-nsDefaultURIFixup::IsDomainWhitelisted(const nsAutoCString aAsciiHost,
+nsDefaultURIFixup::IsDomainWhitelisted(const nsACString& aAsciiHost,
                                        const uint32_t aDotLoc)
 {
   if (sDNSFirstForSingleWords) {
     return true;
   }
   // Check if this domain is whitelisted as an actual
   // domain (which will prevent a keyword query)
   // NB: any processing of the host here should stay in sync with
@@ -1093,17 +1093,17 @@ nsDefaultURIFixup::IsDomainWhitelisted(c
   return Preferences::GetBool(pref.get(), false);
 }
 
 NS_IMETHODIMP
 nsDefaultURIFixup::IsDomainWhitelisted(const nsACString& aDomain,
                                        const uint32_t aDotLoc,
                                        bool* aResult)
 {
-  *aResult = IsDomainWhitelisted(nsAutoCString(aDomain), aDotLoc);
+  *aResult = IsDomainWhitelisted(aDomain, aDotLoc);
   return NS_OK;
 }
 
 /* Implementation of nsIURIFixupInfo */
 NS_IMPL_ISUPPORTS(nsDefaultURIFixupInfo, nsIURIFixupInfo)
 
 nsDefaultURIFixupInfo::nsDefaultURIFixupInfo(const nsACString& aOriginalInput)
   : mFixupChangedProtocol(false)
--- a/docshell/base/nsDefaultURIFixup.h
+++ b/docshell/base/nsDefaultURIFixup.h
@@ -35,17 +35,17 @@ private:
                            nsIInputStream** aPostData);
   nsresult TryKeywordFixupForURIInfo(const nsACString& aStringURI,
                                      nsDefaultURIFixupInfo* aFixupInfo,
                                      nsIInputStream** aPostData);
   bool PossiblyByteExpandedFileName(const nsAString& aIn);
   bool PossiblyHostPortUrl(const nsACString& aUrl);
   bool MakeAlternateURI(nsIURI* aURI);
   bool IsLikelyFTP(const nsCString& aHostSpec);
-  bool IsDomainWhitelisted(const nsAutoCString aAsciiHost,
+  bool IsDomainWhitelisted(const nsACString& aAsciiHost,
                            const uint32_t aDotLoc);
 };
 
 class nsDefaultURIFixupInfo : public nsIURIFixupInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIURIFIXUPINFO