Bug 1354358 - Assert main thread in NS_IMPL_FFI_REFCOUNTING. r=xidorn
authorBobby Holley <bobbyholley@gmail.com>
Thu, 06 Apr 2017 18:07:04 -0700
changeset 558311 3894b9366883168dd8ec8cb3139980d6d57408f0
parent 558310 3315299058de899ef612634359cb0f7abb3132ba
child 558312 4f7947062b4f7d804b1656b5738e761806560e96
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersxidorn
bugs1354358
milestone55.0a1
Bug 1354358 - Assert main thread in NS_IMPL_FFI_REFCOUNTING. r=xidorn MozReview-Commit-ID: 4J7yuJ8Thn0
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -64,18 +64,20 @@ struct nsStyleDisplay;
   { NS_ADDREF(aPtr); }                                                        \
   void Gecko_Release##name_##ArbitraryThread(class_* aPtr)                    \
   { NS_RELEASE(aPtr); }
 
 #define NS_DECL_FFI_REFCOUNTING(class_, name_)  \
   void Gecko_##name_##_AddRef(class_* aPtr);    \
   void Gecko_##name_##_Release(class_* aPtr);
 #define NS_IMPL_FFI_REFCOUNTING(class_, name_)                    \
-  void Gecko_##name_##_AddRef(class_* aPtr) { NS_ADDREF(aPtr); }  \
-  void Gecko_##name_##_Release(class_* aPtr) { NS_RELEASE(aPtr); }
+  void Gecko_##name_##_AddRef(class_* aPtr)                       \
+    { MOZ_ASSERT(NS_IsMainThread()); NS_ADDREF(aPtr); }           \
+  void Gecko_##name_##_Release(class_* aPtr)                      \
+    { MOZ_ASSERT(NS_IsMainThread()); NS_RELEASE(aPtr); }
 
 #define DEFINE_ARRAY_TYPE_FOR(type_)                                \
   struct nsTArrayBorrowed_##type_ {                                 \
     nsTArray<type_>* mArray;                                        \
     MOZ_IMPLICIT nsTArrayBorrowed_##type_(nsTArray<type_>* aArray)  \
       : mArray(aArray) {}                                           \
   }
 DEFINE_ARRAY_TYPE_FOR(uintptr_t);