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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserContext.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/CSSParserContext.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserContext.cpp b/third_party/WebKit/Source/core/css/parser/CSSParserContext.cpp
index 66e3d2a87849e6ecf7608494b46e1e38a03c872a..5c35fb7fbe9bda8c46041cce1e48357a8e32f5b0 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserContext.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserContext.cpp
@@ -10,19 +10,16 @@
namespace blink {
-CSSParserContext::CSSParserContext(CSSParserMode mode,
- UseCounter* useCounter,
- SelectorProfile profile)
+CSSParserContext::CSSParserContext(CSSParserMode mode, SelectorProfile profile)
: m_mode(mode),
m_matchMode(mode),
m_profile(profile),
m_isHTMLDocument(false),
m_useLegacyBackgroundSizeShorthandBehavior(false),
m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy),
- m_useCounter(useCounter) {}
+ m_useCounter(nullptr) {}
CSSParserContext::CSSParserContext(const Document& document,
- UseCounter* useCounter,
const KURL& baseURL,
const String& charset,
SelectorProfile profile)
@@ -39,7 +36,7 @@ CSSParserContext::CSSParserContext(const Document& document,
->getUseLegacyBackgroundSizeShorthandBehavior()
: false),
m_shouldCheckContentSecurityPolicy(DoNotCheckContentSecurityPolicy),
- m_useCounter(useCounter) {
+ m_useCounter(nullptr) {
if (ContentSecurityPolicy::shouldBypassMainWorld(&document))
m_shouldCheckContentSecurityPolicy = DoNotCheckContentSecurityPolicy;
else
@@ -54,19 +51,19 @@ CSSParserContext::CSSParserContext(const Document& document,
}
}
-CSSParserContext::CSSParserContext(const CSSParserContext& other,
+CSSParserContext::CSSParserContext(const CSSParserContext* other,
UseCounter* useCounter)
- : m_baseURL(other.m_baseURL),
- m_charset(other.m_charset),
- m_mode(other.m_mode),
- m_matchMode(other.m_matchMode),
- m_profile(other.m_profile),
- m_referrer(other.m_referrer),
- m_isHTMLDocument(other.m_isHTMLDocument),
+ : m_baseURL(other->m_baseURL),
+ m_charset(other->m_charset),
+ m_mode(other->m_mode),
+ m_matchMode(other->m_matchMode),
+ m_profile(other->m_profile),
+ m_referrer(other->m_referrer),
+ m_isHTMLDocument(other->m_isHTMLDocument),
m_useLegacyBackgroundSizeShorthandBehavior(
- other.m_useLegacyBackgroundSizeShorthandBehavior),
+ other->m_useLegacyBackgroundSizeShorthandBehavior),
m_shouldCheckContentSecurityPolicy(
- other.m_shouldCheckContentSecurityPolicy),
+ other->m_shouldCheckContentSecurityPolicy),
m_useCounter(useCounter) {}
bool CSSParserContext::operator==(const CSSParserContext& other) const {
@@ -78,9 +75,9 @@ bool CSSParserContext::operator==(const CSSParserContext& other) const {
other.m_useLegacyBackgroundSizeShorthandBehavior;
}
-const CSSParserContext& strictCSSParserContext() {
- DEFINE_STATIC_LOCAL(CSSParserContext, strictContext,
- (HTMLStandardMode, nullptr));
+const CSSParserContext* strictCSSParserContext() {
+ static CSSParserContext* strictContext =
rune 2017/01/11 12:59:26 Doesn't it need to be Persistent?
haraken 2017/01/11 13:04:54 Nice catch! This needs to be DEFINE_STATIC_LOCAL(P
sof 2017/01/11 13:09:21 DEFINE_STATIC_LOCAL(T, ...) will implicitly wrap a
Bret 2017/01/11 23:05:15 Done... though needing "&strictContext" doesn't se
+ new CSSParserContext(HTMLStandardMode);
return strictContext;
}

Powered by Google App Engine
This is Rietveld 408576698