Bug 1290218 Part 3: Transition ServoStyleSheet to use mInner pointer, instead of maintaining a static StyleSheetInfo. draft
authorBrad Werth <bwerth@mozilla.com>
Fri, 03 Feb 2017 15:57:51 -0800
changeset 488920 7b976dae3061fe128f32313d8597d7a6c35d3eff
parent 488919 ce81d4fae368b5aa2d29d983605a22ce856a9444
child 488921 64964edc86570bca33f040e8dc15f4febd7e4bf6
push id46687
push userbwerth@mozilla.com
push dateFri, 24 Feb 2017 01:52:48 +0000
bugs1290218
milestone54.0a1
Bug 1290218 Part 3: Transition ServoStyleSheet to use mInner pointer, instead of maintaining a static StyleSheetInfo. MozReview-Commit-ID: K0hjThqClhN
layout/style/ServoStyleSheet.cpp
layout/style/ServoStyleSheet.h
layout/style/StyleSheetInlines.h
--- a/layout/style/ServoStyleSheet.cpp
+++ b/layout/style/ServoStyleSheet.cpp
@@ -18,25 +18,27 @@ using namespace mozilla::dom;
 
 namespace mozilla {
 
 ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode,
                                  CORSMode aCORSMode,
                                  net::ReferrerPolicy aReferrerPolicy,
                                  const dom::SRIMetadata& aIntegrity)
   : StyleSheet(StyleBackendType::Servo, aParsingMode)
-  , mSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity)
 {
+  mInner = new StyleSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity);
 }
 
 ServoStyleSheet::~ServoStyleSheet()
 {
   UnparentChildren();
 
   DropSheet();
+
+  delete mInner;
 }
 
 // QueryInterface implementation for ServoStyleSheet
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ServoStyleSheet)
 NS_INTERFACE_MAP_END_INHERITING(StyleSheet)
 
 NS_IMPL_ADDREF_INHERITED(ServoStyleSheet, StyleSheet)
 NS_IMPL_RELEASE_INHERITED(ServoStyleSheet, StyleSheet)
--- a/layout/style/ServoStyleSheet.h
+++ b/layout/style/ServoStyleSheet.h
@@ -82,16 +82,15 @@ protected:
   void EnabledStateChangedInternal() {}
 
 private:
   void DropSheet();
   void DropRuleList();
 
   RefPtr<RawServoStyleSheet> mSheet;
   RefPtr<ServoCSSRuleList> mRuleList;
-  StyleSheetInfo mSheetInfo;
 
   friend class StyleSheet;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_ServoStyleSheet_h
--- a/layout/style/StyleSheetInlines.h
+++ b/layout/style/StyleSheetInlines.h
@@ -13,29 +13,23 @@
 
 namespace mozilla {
 
 MOZ_DEFINE_STYLO_METHODS(StyleSheet, CSSStyleSheet, ServoStyleSheet)
 
 StyleSheetInfo&
 StyleSheet::SheetInfo()
 {
-  if (IsServo()) {
-    return AsServo()->mSheetInfo;
-  }
-  return *AsGecko()->mInner;
+  return *mInner;
 }
 
 const StyleSheetInfo&
 StyleSheet::SheetInfo() const
 {
-  if (IsServo()) {
-    return AsServo()->mSheetInfo;
-  }
-  return *AsGecko()->mInner;
+  return *mInner;
 }
 
 bool
 StyleSheet::IsInline() const
 {
   return !SheetInfo().mOriginalSheetURI;
 }