Bug 1336510 - Part 5: Workaround lambda static analysis in nsMultiMixedConv, r=valentin

MozReview-Commit-ID: 7Mvh9aeCKOh
This commit is contained in:
Michael Layzell 2017-02-14 14:40:26 -05:00
parent cab1a9949b
commit 9509bedeee

View File

@ -801,9 +801,14 @@ nsMultiMixedConv::SwitchToControlParsing()
nsMultiMixedConv::nsMultiMixedConv() :
mCurrentPartID(0),
mInOnDataAvailable(false),
mTokenizer([this](Token const& token, mozilla::IncrementalTokenizer&) -> nsresult {
return this->ConsumeToken(token);
})
// XXX: This is a hack to bypass the raw pointer to refcounted object in
// lambda analysis. It should be removed and replaced when the
// IncrementalTokenizer API is improved to avoid the need for such
// workarounds.
//
// This is safe because `mTokenizer` will not outlive `this`, meaning that
// this std::bind object will be destroyed before `this` dies.
mTokenizer(std::bind(&nsMultiMixedConv::ConsumeToken, this, std::placeholders::_1))
{
mContentLength = UINT64_MAX;
mByteRangeStart = 0;