Bug 1464060: Unify DoGetStyle* implementations. r=xidorn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 25 May 2018 21:06:52 +0200
changeset 476853 f44f6ecbc3fec05fae6391dae99fcbf389a7e26f
parent 476852 a28175c98d9071037b7162dbd1ceecb2ec88a6bb
child 476854 6c810824801165195a67811345634d6554542191
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1464060
milestone62.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 1464060: Unify DoGetStyle* implementations. r=xidorn Both branches are equal now. MozReview-Commit-ID: 2XmYvGC0ETx
layout/style/ComputedStyleInlines.h
--- a/layout/style/ComputedStyleInlines.h
+++ b/layout/style/ComputedStyleInlines.h
@@ -34,56 +34,37 @@ ComputedStyle::ThreadsafeStyle##name_() 
 }                                                           \
 const nsStyle##name_ * ComputedStyle::PeekStyle##name_() {  \
   return DoGetStyle##name_<false>();                        \
 }
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT
 
 // Helper functions for GetStyle* and PeekStyle*
-#define STYLE_STRUCT_INHERITED(name_)                                       \
+#define STYLE_STRUCT(name_)                                                 \
 template<bool aComputeData>                                                 \
-const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {                 \
+const nsStyle##name_* ComputedStyle::DoGetStyle##name_() {                  \
   const auto kStructID = StyleStructID::name_;                              \
   const bool needToCompute = !HasRequestedStruct(kStructID);                \
   if (!aComputeData && needToCompute) {                                     \
     return nullptr;                                                         \
   }                                                                         \
   const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
   /* perform any remaining main thread work on the struct */                \
   if (needToCompute) {                                                      \
     MOZ_ASSERT(NS_IsMainThread());                                          \
     MOZ_ASSERT(!mozilla::IsInServoTraversal());                             \
     const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
     /* the ComputedStyle owns the struct */                                 \
     SetRequestedStruct(kStructID);                                          \
   }                                                                         \
   return data;                                                              \
 }
-
-#define STYLE_STRUCT_RESET(name_)                                           \
-template<bool aComputeData>                                                 \
-const nsStyle##name_ * ComputedStyle::DoGetStyle##name_() {                 \
-  const auto kStructID = StyleStructID::name_;                              \
-  const bool needToCompute = !HasRequestedStruct(kStructID);                \
-  if (!aComputeData && needToCompute) {                                     \
-    return nullptr;                                                         \
-  }                                                                         \
-  const nsStyle##name_* data = ComputedData()->GetStyle##name_();           \
-  /* perform any remaining main thread work on the struct */                \
-  if (needToCompute) {                                                      \
-    const_cast<nsStyle##name_*>(data)->FinishStyle(mPresContext, nullptr);  \
-    /* the ComputedStyle owns the struct */                                 \
-    SetRequestedStruct(kStructID);                                          \
-  }                                                                         \
-  return data;                                                              \
-}
 #include "nsStyleStructList.h"
-#undef STYLE_STRUCT_RESET
-#undef STYLE_STRUCT_INHERITED
+#undef STYLE_STRUCT
 
 void
 ComputedStyle::StartBackgroundImageLoads()
 {
   // Just get our background struct; that should do the trick
   StyleBackground();
 }