Bug 1382964 - Part 3: Add assertion to help heap write analysis. r=xidorn draft
authorCameron McCormack <cam@mcc.id.au>
Sun, 23 Jul 2017 09:11:37 +0800
changeset 613890 e91311c2bb53096bb13d811898f03084cfdf6b36
parent 613889 886f354f9b8e1e1ef303513faebecf8c44a4bfc6
child 613891 d99726105bd085ad7ff36ad45012b69b64f56704
child 613894 aa75e92ab9e7ba6d820886debbd4f860c1d54642
push id69872
push userbmo:cam@mcc.id.au
push dateSun, 23 Jul 2017 07:51:39 +0000
reviewersxidorn
bugs1382964
milestone56.0a1
Bug 1382964 - Part 3: Add assertion to help heap write analysis. r=xidorn MozReview-Commit-ID: Lfa5Cijgqzp
layout/style/nsStyleContext.cpp
--- 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) {