Bug 1435671 - Reduce binary size by making NS_MutateURI.Apply not be a templated method r=mayhemer

We instead add a templated method NS_MutatorMethod that returns a std::function<nsresult(nsIURIMutator*)> which Apply then calls with mMutator as an argument.
The function returned by NS_MutatorMethod performs a QueryInterface, then calls the passed method with arguments on the result.

MozReview-Commit-ID: Jjqp7gGLG1D
This commit is contained in:
Valentin Gosu
2018-02-21 01:00:54 +01:00
parent f97643f03f
commit 58b69cefa1
18 changed files with 133 additions and 103 deletions

View File

@@ -141,12 +141,13 @@ nsAndroidProtocolHandler::NewURI(const nsACString &aSpec,
nsIURI *aBaseURI,
nsIURI **result)
{
nsCOMPtr<nsIURI> base(aBaseURI);
return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
.Apply<nsIStandardURLMutator>(&nsIStandardURLMutator::Init,
nsIStandardURL::URLTYPE_STANDARD, -1,
nsCString(aSpec), aCharset, aBaseURI,
nullptr)
.Finalize(result);
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
nsIStandardURL::URLTYPE_STANDARD,
-1, nsCString(aSpec), aCharset,
base, nullptr))
.Finalize(result);
}
NS_IMETHODIMP