Bug 1477599 - Move StyloParsingBench helper functions into #if as well. r?emilio draft
authorXidorn Quan <me@upsuper.org>
Mon, 23 Jul 2018 09:51:41 +1000
changeset 821329 3a03d73e4b30ea52cd02c7ca9ea0b531b5c00b14
parent 821328 7a0ec05fa47970ba794a61879f5217dfdb58a67c
child 821334 49a0290d1a95286236e95573705b538215a21ab5
push id117062
push userxquan@mozilla.com
push dateSun, 22 Jul 2018 23:52:16 +0000
reviewersemilio
bugs1477599
milestone63.0a1
Bug 1477599 - Move StyloParsingBench helper functions into #if as well. r?emilio MozReview-Commit-ID: GhcdIdX6IBk
layout/style/test/gtest/StyloParsingBench.cpp
--- a/layout/style/test/gtest/StyloParsingBench.cpp
+++ b/layout/style/test/gtest/StyloParsingBench.cpp
@@ -12,21 +12,23 @@
 #include "mozilla/Encoding.h"
 #include "mozilla/NullPrincipalURI.h"
 
 using namespace mozilla;
 using namespace mozilla::css;
 using namespace mozilla::dom;
 using namespace mozilla::net;
 
+// Bug 1436018 - Disable Stylo microbenchmark on Windows
+#if !defined(_WIN32) && !defined(_WIN64)
+
 #define PARSING_REPETITIONS 20
 #define SETPROPERTY_REPETITIONS (1000 * 1000)
 #define GETPROPERTY_REPETITIONS (1000 * 1000)
 
-
 static void ServoParsingBench() {
 
   auto css = AsBytes(MakeStringSpan(EXAMPLE_STYLESHEET));
   nsCString cssStr;
   cssStr.Append(css);
   ASSERT_EQ(Encoding::UTF8ValidUpTo(css), css.Length());
 
   RefPtr<URLExtraData> data = new URLExtraData(
@@ -93,22 +95,21 @@ static void ServoGetPropertyValueById() 
       block,
       eCSSProperty_width,
       &value
     );
     ASSERT_TRUE(value.EqualsLiteral("10px"));
   }
 }
 
-// Bug 1436018 - Disable Stylo microbenchmark on Windows
-#if !defined(_WIN32) && !defined(_WIN64)
 MOZ_GTEST_BENCH(Stylo, Servo_StyleSheet_FromUTF8Bytes_Bench, ServoParsingBench);
 
 MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_Bench, [] {
   ServoSetPropertyByIdBench(NS_LITERAL_CSTRING("10px"));
 });
 
 MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_SetPropertyById_WithInitialSpace_Bench, [] {
   ServoSetPropertyByIdBench(NS_LITERAL_CSTRING(" 10px"));
 });
 
 MOZ_GTEST_BENCH(Stylo, Servo_DeclarationBlock_GetPropertyById_Bench, ServoGetPropertyValueById);
+
 #endif