Bug 1551991 - followup: Give up on passing CounterSpeakAs by value since the previous patch busted non-Windows platforms.
authorEmilio Cobos Álvarez <emilio@crisal.io>
Fri, 17 May 2019 06:43:39 +0200
changeset 533114 f41aae1abbbaaddf29087d312cb91fa25578b45b
parent 533113 83a094f31fb025b5cb6b196003708b746f0591b6
child 533115 eeb6dd82b7c1a9fc36610bfe1ccecdf93c356677
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1551991
milestone68.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 1551991 - followup: Give up on passing CounterSpeakAs by value since the previous patch busted non-Windows platforms. CLOSED TREE
layout/style/CounterStyleManager.cpp
servo/ports/geckolib/glue.rs
--- a/layout/style/CounterStyleManager.cpp
+++ b/layout/style/CounterStyleManager.cpp
@@ -1333,17 +1333,18 @@ uint8_t CustomCounterStyle::GetSpeakAsAu
 // out the raw value. To keep things clear, this method is designed to
 // have no side effects (but functions it calls may still affect other
 // fields in the style.)
 void CustomCounterStyle::ComputeRawSpeakAs(uint8_t& aSpeakAs,
                                            CounterStyle*& aSpeakAsCounter) {
   NS_ASSERTION(!(mFlags & FLAG_SPEAKAS_INITED),
                "ComputeRawSpeakAs is called with speak-as inited.");
 
-  auto speakAs = Servo_CounterStyleRule_GetSpeakAs(mRule);
+  auto speakAs = StyleCounterSpeakAs::None();
+  Servo_CounterStyleRule_GetSpeakAs(mRule, &speakAs);
   switch (speakAs.tag) {
     case StyleCounterSpeakAs::Tag::Auto:
       aSpeakAs = GetSpeakAsAutoValue();
       break;
     case StyleCounterSpeakAs::Tag::Bullets:
       aSpeakAs = NS_STYLE_COUNTER_SPEAKAS_BULLETS;
       break;
     case StyleCounterSpeakAs::Tag::Numbers:
--- a/servo/ports/geckolib/glue.rs
+++ b/servo/ports/geckolib/glue.rs
@@ -3113,48 +3113,45 @@ pub unsafe extern "C" fn Servo_CounterSt
                     symbol: symbol_to_string(&s.symbol),
                 }
             }).collect(),
             None => style::OwnedSlice::default(),
         };
     })
 }
 
-/// Don't derive destructors so that it's POD and we can pass it by value
-/// without issues.
-///
-/// cbindgen:derive-tagged-enum-destructor=false
 #[repr(C, u8)]
 pub enum CounterSpeakAs {
     None,
     Auto,
     Bullets,
     Numbers,
     Words,
     Ident(*mut nsAtom),
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetSpeakAs(
     rule: &RawServoCounterStyleRule,
-) -> CounterSpeakAs {
+    out: &mut CounterSpeakAs,
+) {
     use style::counter_style::SpeakAs;
-    read_locked_arc(rule, |rule: &CounterStyleRule| {
+    *out = read_locked_arc(rule, |rule: &CounterStyleRule| {
         let speak_as = match rule.speak_as() {
             Some(s) => s,
             None => return CounterSpeakAs::None,
         };
         match *speak_as {
             SpeakAs::Auto => CounterSpeakAs::Auto,
             SpeakAs::Bullets => CounterSpeakAs::Bullets,
             SpeakAs::Numbers => CounterSpeakAs::Numbers,
             SpeakAs::Words => CounterSpeakAs::Words,
             SpeakAs::Other(ref other) => CounterSpeakAs::Ident(other.0.as_ptr()),
         }
-    })
+    });
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn Servo_CounterStyleRule_GetSystem(
     rule: &RawServoCounterStyleRule,
 ) -> u8 {
     use style::counter_style::System;
     read_locked_arc(rule, |rule: &CounterStyleRule| {