Bug 1317250 - Avoid a copy in nsCookieService::FindStaleCookie r?jdm
MozReview-Commit-ID: G61TtsTNU7x
--- a/netwerk/cookie/nsCookieService.cpp
+++ b/netwerk/cookie/nsCookieService.cpp
@@ -4508,17 +4508,17 @@ nsCookieService::CookieExistsNative(nsIC
}
// For a given base domain, find either an expired cookie or the oldest cookie
// by lastAccessed time.
int64_t
nsCookieService::FindStaleCookie(nsCookieEntry *aEntry,
int64_t aCurrentTime,
nsIURI* aSource,
- mozilla::Maybe<bool> aIsSecure,
+ const mozilla::Maybe<bool> &aIsSecure,
nsListIter &aIter)
{
aIter.entry = nullptr;
bool requireHostMatch = true;
nsAutoCString baseDomain, sourceHost, sourcePath;
if (aSource) {
GetBaseDomain(aSource, baseDomain, requireHostMatch);
aSource->GetAsciiHost(sourceHost);
--- a/netwerk/cookie/nsCookieService.h
+++ b/netwerk/cookie/nsCookieService.h
@@ -308,17 +308,17 @@ class nsCookieService final : public nsI
bool CheckDomain(nsCookieAttributes &aCookie, nsIURI *aHostURI, const nsCString &aBaseDomain, bool aRequireHostMatch);
static bool CheckPath(nsCookieAttributes &aCookie, nsIURI *aHostURI);
static bool CheckPrefixes(nsCookieAttributes &aCookie, bool aSecureRequest);
static bool GetExpiry(nsCookieAttributes &aCookie, int64_t aServerTime, int64_t aCurrentTime);
void RemoveAllFromMemory();
already_AddRefed<nsIArray> PurgeCookies(int64_t aCurrentTimeInUsec);
bool FindCookie(const nsCookieKey& aKey, const nsAFlatCString &aHost, const nsAFlatCString &aName, const nsAFlatCString &aPath, nsListIter &aIter);
bool FindSecureCookie(const nsCookieKey& aKey, nsCookie* aCookie);
- int64_t FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsIURI* aSource, mozilla::Maybe<bool> aIsSecure, nsListIter &aIter);
+ int64_t FindStaleCookie(nsCookieEntry *aEntry, int64_t aCurrentTime, nsIURI* aSource, const mozilla::Maybe<bool> &aIsSecure, nsListIter &aIter);
void TelemetryForEvictingStaleCookie(nsCookie* aEvicted, int64_t oldestCookieTime);
void NotifyRejected(nsIURI *aHostURI);
void NotifyThirdParty(nsIURI *aHostURI, bool aAccepted, nsIChannel *aChannel);
void NotifyChanged(nsISupports *aSubject, const char16_t *aData);
void NotifyPurged(nsICookie2* aCookie);
already_AddRefed<nsIArray> CreatePurgeList(nsICookie2* aCookie);
void UpdateCookieOldestTime(DBState* aDBState, nsCookie* aCookie);