Bug 1477599 - Move StyloParsingBench helper functions into #if as well. r?emilio
MozReview-Commit-ID: GhcdIdX6IBk
--- 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