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

Unified Diff: third_party/WebKit/Source/core/css/MediaQueryExp.cpp

Issue 2873433003: Move MediaQuery classes off BlinkGC heap (Closed)
Patch Set: Created 3 years, 7 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/MediaQueryExp.cpp
diff --git a/third_party/WebKit/Source/core/css/MediaQueryExp.cpp b/third_party/WebKit/Source/core/css/MediaQueryExp.cpp
index ada04787593ec528568be1cd998181f447844d8d..aa32837acc1eb35d78cadd303f617b87b4cc7b53 100644
--- a/third_party/WebKit/Source/core/css/MediaQueryExp.cpp
+++ b/third_party/WebKit/Source/core/css/MediaQueryExp.cpp
@@ -216,7 +216,7 @@ MediaQueryExp::MediaQueryExp(const String& mediaFeature,
const MediaQueryExpValue& expValue)
: m_mediaFeature(mediaFeature), m_expValue(expValue) {}
-MediaQueryExp* MediaQueryExp::createIfValid(
+MediaQueryExp MediaQueryExp::create(
const String& mediaFeature,
const Vector<CSSParserToken, 4>& tokenList) {
ASSERT(!mediaFeature.isNull());
@@ -233,7 +233,7 @@ MediaQueryExp* MediaQueryExp::createIfValid(
if (token.type() == IdentToken) {
CSSValueID ident = token.id();
if (!featureWithValidIdent(lowerMediaFeature, ident))
- return nullptr;
+ return invalid();
expValue.id = ident;
expValue.isID = true;
} else if (token.type() == NumberToken || token.type() == PercentageToken ||
@@ -258,10 +258,10 @@ MediaQueryExp* MediaQueryExp::createIfValid(
expValue.unit = CSSPrimitiveValue::UnitType::Number;
expValue.isValue = true;
} else {
- return nullptr;
+ return invalid();
}
} else {
- return nullptr;
+ return invalid();
}
} else if (tokenList.size() == 3 &&
featureWithAspectRatio(lowerMediaFeature)) {
@@ -271,22 +271,22 @@ MediaQueryExp* MediaQueryExp::createIfValid(
const CSSParserToken& delimiter = tokenList[1];
const CSSParserToken& denominator = tokenList[2];
if (delimiter.type() != DelimiterToken || delimiter.delimiter() != '/')
- return nullptr;
+ return invalid();
if (numerator.type() != NumberToken || numerator.numericValue() <= 0 ||
numerator.numericValueType() != IntegerValueType)
- return nullptr;
+ return invalid();
if (denominator.type() != NumberToken || denominator.numericValue() <= 0 ||
denominator.numericValueType() != IntegerValueType)
- return nullptr;
+ return invalid();
expValue.numerator = (unsigned)numerator.numericValue();
expValue.denominator = (unsigned)denominator.numericValue();
expValue.isRatio = true;
} else {
- return nullptr;
+ return invalid();
}
- return new MediaQueryExp(lowerMediaFeature, expValue);
+ return MediaQueryExp(lowerMediaFeature, expValue);
}
MediaQueryExp::~MediaQueryExp() {}
« no previous file with comments | « third_party/WebKit/Source/core/css/MediaQueryExp.h ('k') | third_party/WebKit/Source/core/css/MediaQueryList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698