Bug 1290218 Part 3: Transition ServoStyleSheet to use mInner pointer, instead of maintaining a static StyleSheetInfo. r=heycam
authorBrad Werth <bwerth@mozilla.com>
Fri, 03 Feb 2017 15:57:51 -0800
changeset 373584 5e9b9569c297ee944aa7b6eece3ba2b7cf65e088
parent 373583 ea165fd4359a00fe9d9fab92f505783d6b05edd1
child 373585 b433bbbd6228fa4a0bdfb3fc4b0fcdc562fb419b
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1290218
milestone54.0a1
Bug 1290218 Part 3: Transition ServoStyleSheet to use mInner pointer, instead of maintaining a static StyleSheetInfo. r=heycam 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;
 }