Bug 1382964 - Part 3: Add assertion to help heap write analysis. r=xidorn
MozReview-Commit-ID: Lfa5Cijgqzp
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -214,16 +214,20 @@ nsStyleContext::CalcStyleDifference(nsSt
// nobody ever looked at that struct's data). In other words, we
// can't skip later structs if we get a big change up front, because
// we could later get a small change in one of those structs that we
// don't want to miss.
DebugOnly<uint32_t> structsFound = 0;
if (IsGecko()) {
+ // CalcStyleDifference is always called on the main thread for Gecko
+ // style contexts. This assertion helps the heap write static analysis.
+ MOZ_ASSERT(NS_IsMainThread());
+
// FIXME(heycam): We should just do the comparison in
// nsStyleVariables::CalcDifference, returning NeutralChange if there are
// any Variables differences.
const nsStyleVariables* thisVariables = PeekStyleVariables();
if (thisVariables) {
structsFound |= NS_STYLE_INHERIT_BIT(Variables);
const nsStyleVariables* otherVariables = aNewContext->StyleVariables();
if (thisVariables->mVariables == otherVariables->mVariables) {