Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp

Issue 2616093003: Make CSSParserContext be garbage collected. (Closed)
Patch Set: fix fuzzer compile Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp
index 064e172cc612f1459bf4465ad006d2dc2e302723..a4c533f109248945a2aa5d0ecbcb8111bfe263c4 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingTest.cpp
@@ -33,7 +33,7 @@ class CSSLazyParsingTest : public testing::Test {
};
TEST_F(CSSLazyParsingTest, Simple) {
- CSSParserContext context(HTMLStandardMode, nullptr);
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
StyleSheetContents* styleSheet = StyleSheetContents::create(context);
String sheetText = "body { background-color: red; }";
@@ -47,7 +47,7 @@ TEST_F(CSSLazyParsingTest, Simple) {
// Avoiding lazy parsing for trivially empty blocks helps us perform the
// shouldConsiderForMatchingRules optimization.
TEST_F(CSSLazyParsingTest, DontLazyParseEmpty) {
- CSSParserContext context(HTMLStandardMode, nullptr);
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
StyleSheetContents* styleSheet = StyleSheetContents::create(context);
String sheetText = "body { }";
@@ -61,7 +61,7 @@ TEST_F(CSSLazyParsingTest, DontLazyParseEmpty) {
// Avoid parsing rules with ::before or ::after to avoid causing
// collectFeatures() when we trigger parsing for attr();
TEST_F(CSSLazyParsingTest, DontLazyParseBeforeAfter) {
- CSSParserContext context(HTMLStandardMode, nullptr);
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
StyleSheetContents* styleSheet = StyleSheetContents::create(context);
String sheetText =
@@ -77,7 +77,7 @@ TEST_F(CSSLazyParsingTest, DontLazyParseBeforeAfter) {
// dangerous API because callers will expect the set of matching rules to be
// identical if the stylesheet is not mutated.
TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesDoesntChange1) {
- CSSParserContext context(HTMLStandardMode, nullptr);
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
StyleSheetContents* styleSheet = StyleSheetContents::create(context);
String sheetText = "p::first-letter { ,badness, } ";
@@ -100,7 +100,7 @@ TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesDoesntChange1) {
// Test the same thing as above, with a property that does not get lazy parsed,
// to ensure that we perform the optimization where possible.
TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesSimple) {
- CSSParserContext context(HTMLStandardMode, nullptr);
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
StyleSheetContents* styleSheet = StyleSheetContents::create(context);
String sheetText = "p::before { ,badness, } ";
@@ -118,8 +118,8 @@ TEST_F(CSSLazyParsingTest, ShouldConsiderForMatchingRulesSimple) {
TEST_F(CSSLazyParsingTest, ChangeDocuments) {
std::unique_ptr<DummyPageHolder> dummyHolder =
DummyPageHolder::create(IntSize(500, 500));
- CSSParserContext context(HTMLStandardMode,
- UseCounter::getFrom(&dummyHolder->document()));
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
+ context->setUseCounter(UseCounter::getFrom(&dummyHolder->document()));
m_cachedContents = StyleSheetContents::create(context);
{
CSSStyleSheet* sheet =
@@ -169,7 +169,7 @@ TEST_F(CSSLazyParsingTest, ChangeDocuments) {
}
TEST_F(CSSLazyParsingTest, SimpleRuleUsagePercent) {
- CSSParserContext context(HTMLStandardMode, nullptr);
+ CSSParserContext* context = new CSSParserContext(HTMLStandardMode);
StyleSheetContents* styleSheet = StyleSheetContents::create(context);
std::string metricName = "Style.LazyUsage.Percent";

Powered by Google App Engine
This is Rietveld 408576698