Bug 1304792: Use borrowed types for ServoImportRule. r=Manishearth r=heycam
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 29 Dec 2016 18:33:47 +0100
changeset 327663 82fe5697e8faa2d0702b8694ea4b8e588a9368c7
parent 327662 ab2e9b88f958292d03d5edd41442c61ecd81b5af
child 327664 8494bff5a73129bc451e1531cf1734e8e7ba74a1
push id85241
push userecoal95@gmail.com
push dateFri, 30 Dec 2016 15:30:55 +0000
treeherdermozilla-inbound@82fe5697e8fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersManishearth, heycam
bugs1304792
milestone53.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 1304792: Use borrowed types for ServoImportRule. r=Manishearth r=heycam MozReview-Commit-ID: HKjsOaE2qAp Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
layout/style/Loader.cpp
layout/style/Loader.h
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -1402,17 +1402,17 @@ Loader::InsertSheetInDoc(StyleSheet* aSh
  * want to insert the sheet at the correct position, we'll need to
  * restore CSSStyleSheet::InsertStyleSheetAt, which was removed in
  * bug 1220506.)
  */
 nsresult
 Loader::InsertChildSheet(StyleSheet* aSheet,
                          StyleSheet* aParentSheet,
                          ImportRule* aGeckoParentRule,
-                         RawServoImportRule* aServoParentRule)
+                         const RawServoImportRule* aServoParentRule)
 {
   LOG(("css::Loader::InsertChildSheet"));
   MOZ_ASSERT(aSheet, "Nothing to insert");
   MOZ_ASSERT(aParentSheet, "Need a parent to insert into");
   MOZ_ASSERT_IF(aSheet->IsGecko(), aGeckoParentRule && !aServoParentRule);
   MOZ_ASSERT_IF(aSheet->IsServo(), aServoParentRule && !aGeckoParentRule);
   if (aSheet->IsGecko()) {
     // child sheets should always start out enabled, even if they got
@@ -2193,17 +2193,17 @@ HaveAncestorDataWithURI(SheetLoadData *a
   return false;
 }
 
 nsresult
 Loader::LoadChildSheet(StyleSheet* aParentSheet,
                        nsIURI* aURL,
                        nsMediaList* aMedia,
                        ImportRule* aGeckoParentRule,
-                       RawServoImportRule* aServoParentRule,
+                       const RawServoImportRule* aServoParentRule,
                        LoaderReusableStyleSheets* aReusableSheets)
 {
   LOG(("css::Loader::LoadChildSheet"));
   NS_PRECONDITION(aURL, "Must have a URI to load");
   NS_PRECONDITION(aParentSheet, "Must have a parent sheet");
 
   // Servo doesn't support reusable sheets.
   MOZ_ASSERT_IF(aReusableSheets, aParentSheet->IsGecko());
--- a/layout/style/Loader.h
+++ b/layout/style/Loader.h
@@ -292,17 +292,17 @@ public:
    *                         Servo's style system.
    * @param aSavedSheets any saved style sheets which could be reused
    *              for this load
    */
   nsresult LoadChildSheet(StyleSheet* aParentSheet,
                           nsIURI* aURL,
                           nsMediaList* aMedia,
                           ImportRule* aGeckoParentRule,
-                          RawServoImportRule* aServoParentRule,
+                          const RawServoImportRule* aServoParentRule,
                           LoaderReusableStyleSheets* aSavedSheets);
 
   /**
    * Synchronously load and return the stylesheet at aURL.  Any child sheets
    * will also be loaded synchronously.  Note that synchronous loads over some
    * protocols may involve spinning up a new event loop, so use of this method
    * does NOT guarantee not receiving any events before the sheet loads.  This
    * method can be used to load sheets not associated with a document.
@@ -484,17 +484,17 @@ private:
 
   nsresult InsertSheetInDoc(StyleSheet* aSheet,
                             nsIContent* aLinkingContent,
                             nsIDocument* aDocument);
 
   nsresult InsertChildSheet(StyleSheet* aSheet,
                             StyleSheet* aParentSheet,
                             ImportRule* aGeckoParentRule,
-                            RawServoImportRule* aServoParentRule);
+                            const RawServoImportRule* aServoParentRule);
 
   nsresult InternalLoadNonDocumentSheet(nsIURI* aURL,
                                         bool aIsPreload,
                                         SheetParsingMode aParsingMode,
                                         bool aUseSystemPrincipal,
                                         nsIPrincipal* aOriginPrincipal,
                                         const nsCString& aCharset,
                                         RefPtr<StyleSheet>* aSheet,
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -1027,17 +1027,17 @@ nsCSSValueBorrowedMut
 Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut aCSSValue, int32_t aIndex)
 {
   return &aCSSValue->GetArrayValue()->Item(aIndex);
 }
 
 void
 Gecko_LoadStyleSheet(css::Loader* aLoader,
                      ServoStyleSheet* aParent,
-                     RawServoImportRuleStrong aImportRule,
+                     RawServoImportRuleBorrowed aImportRule,
                      const uint8_t* aURLString,
                      uint32_t aURLStringLength,
                      const uint8_t* aMediaString,
                      uint32_t aMediaStringLength)
 {
   MOZ_ASSERT(aLoader, "Should've catched this before");
   MOZ_ASSERT(aParent, "Only used for @import, so parent should exist!");
   MOZ_ASSERT(aURLString, "Invalid URLs shouldn't be loaded!");
@@ -1055,18 +1055,17 @@ Gecko_LoadStyleSheet(css::Loader* aLoade
 
   nsDependentCSubstring urlSpec(reinterpret_cast<const char*>(aURLString),
                                 aURLStringLength);
 
   // Servo's loader guarantees that the URL is valid.
   nsCOMPtr<nsIURI> uri;
   MOZ_ALWAYS_SUCCEEDS(NS_NewURI(getter_AddRefs(uri), urlSpec));
 
-  RefPtr<RawServoImportRule> import = aImportRule.Consume();
-  aLoader->LoadChildSheet(aParent, uri, media, nullptr, import, nullptr);
+  aLoader->LoadChildSheet(aParent, uri, media, nullptr, aImportRule, nullptr);
 }
 
 NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
 
 #define STYLE_STRUCT(name, checkdata_cb)                                      \
                                                                               \
 void                                                                          \
 Gecko_Construct_nsStyle##name(nsStyle##name* ptr)                             \
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -93,17 +93,17 @@ RawGeckoNodeBorrowedOrNull Gecko_GetNext
 RawGeckoElementBorrowedOrNull Gecko_GetParentElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetFirstChildElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetLastChildElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetPrevSiblingElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetNextSiblingElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetDocumentElement(RawGeckoDocumentBorrowed document);
 void Gecko_LoadStyleSheet(mozilla::css::Loader* loader,
                           mozilla::ServoStyleSheet* parent,
-                          RawServoImportRuleStrong import_rule,
+                          RawServoImportRuleBorrowed import_rule,
                           const uint8_t* url_bytes,
                           uint32_t url_length,
                           const uint8_t* media_bytes,
                           uint32_t media_length);
 
 // By default, Servo walks the DOM by traversing the siblings of the DOM-view
 // first child. This generally works, but misses anonymous children, which we
 // want to traverse during styling. To support these cases, we create an