Bug 1348602 - Assert main thread when setting style bits. r=emilio
authorBobby Holley <bobbyholley@gmail.com>
Mon, 20 Mar 2017 14:43:42 -0700
changeset 348458 871c3cb994bebf67abd228a807befc98c764dee2
parent 348457 b6fa6328adefe9cc333727d9827327f3ba3612e3
child 348459 27ee69dbbf5a30cfee62bfd966a186e649842135
push id39185
push userbholley@mozilla.com
push dateMon, 20 Mar 2017 22:31:26 +0000
treeherderautoland@871c3cb994be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1348602
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1348602 - Assert main thread when setting style bits. r=emilio We also assert against the Servo traversal because we don't currently test the parallel traversal on CI (though we will soon). MozReview-Commit-ID: 9GRNizE44Oi
layout/style/nsStyleContext.h
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -683,16 +683,18 @@ private:
       if (!aComputeData && needToCompute) {                             \
         return nullptr;                                                 \
       }                                                                 \
                                                                         \
       const nsStyle##name_* data =                                      \
         Servo_GetStyle##name_(mSource.AsServoComputedValues());         \
       /* perform any remaining main thread work on the struct */        \
       if (needToCompute) {                                              \
+        MOZ_ASSERT(NS_IsMainThread());                                  \
+        MOZ_ASSERT(!mozilla::ServoStyleSet::IsInServoTraversal());      \
         const_cast<nsStyle##name_*>(data)->FinishStyle(PresContext());  \
         /* the Servo-backed StyleContextSource owns the struct */       \
         AddStyleBit(NS_STYLE_INHERIT_BIT(name_));                       \
       }                                                                 \
       return data;                                                      \
     }
 
   #define STYLE_STRUCT_RESET(name_, checkdata_cb_)                      \