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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSParserContext.h

Issue 2616093003: Make CSSParserContext be garbage collected. (Closed)
Patch Set: fix fuzzer compile again 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.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSParserContext.h b/third_party/WebKit/Source/core/css/parser/CSSParserContext.h
index b96c3db467e536ec14bba21ebeb28bc3ddd68407..fbe7c94d667b3d88df45050f9d836bba3996ae92 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSParserContext.h
+++ b/third_party/WebKit/Source/core/css/parser/CSSParserContext.h
@@ -13,31 +13,41 @@
namespace blink {
+class CSSStyleSheet;
class Document;
+class StyleSheetContents;
class UseCounter;
-class CORE_EXPORT CSSParserContext {
- USING_FAST_MALLOC(CSSParserContext);
-
+class CORE_EXPORT CSSParserContext
+ : public GarbageCollectedFinalized<CSSParserContext> {
public:
// https://drafts.csswg.org/selectors/#profiles
enum SelectorProfile { DynamicProfile, StaticProfile };
- CSSParserContext(CSSParserMode,
- UseCounter*,
- SelectorProfile = DynamicProfile);
- // FIXME: We shouldn't need the UseCounter argument as we could infer it from
- // the Document but some callers want to disable use counting (e.g. the
- // WebInspector).
- CSSParserContext(const Document&,
- UseCounter*,
- const KURL& baseURL = KURL(),
- const String& charset = emptyString(),
- SelectorProfile = DynamicProfile);
+ // All three of these factories copy the context and override the current
+ // UseCounter handle.
+ static CSSParserContext* createWithStyleSheet(const CSSParserContext*,
+ const CSSStyleSheet*);
+ static CSSParserContext* createWithStyleSheetContents(
+ const CSSParserContext*,
+ const StyleSheetContents*);
// FIXME: This constructor shouldn't exist if we properly piped the UseCounter
// through the CSS subsystem. Currently the UseCounter life time is too crazy
// and we need a way to override it.
- CSSParserContext(const CSSParserContext&, UseCounter*);
+ static CSSParserContext* create(const CSSParserContext* other, UseCounter*);
+
+ static CSSParserContext* create(CSSParserMode,
+ SelectorProfile = DynamicProfile,
+ UseCounter* = nullptr);
+ // FIXME: We shouldn't need the UseCounter argument as we could infer it from
+ // the Document but some callers want to disable use counting (e.g. the
+ // WebInspector).
+ static CSSParserContext* create(const Document&, UseCounter*);
+ static CSSParserContext* create(const Document&,
+ const KURL& baseURLOverride = KURL(),
+ const String& charset = emptyString(),
+ SelectorProfile = DynamicProfile,
+ UseCounter* = nullptr);
bool operator==(const CSSParserContext&) const;
bool operator!=(const CSSParserContext& other) const {
@@ -73,12 +83,26 @@ class CORE_EXPORT CSSParserContext {
// This may return nullptr if counting is disabled.
// See comments on constructors.
UseCounter* useCounter() const { return m_useCounter; }
+ bool isUseCounterRecordingEnabled() const { return m_useCounter; }
ContentSecurityPolicyDisposition shouldCheckContentSecurityPolicy() const {
return m_shouldCheckContentSecurityPolicy;
}
+ DEFINE_INLINE_TRACE() {}
+
private:
+ CSSParserContext(const KURL& baseURL,
+ const String& charset,
+ CSSParserMode,
+ CSSParserMode matchMode,
+ SelectorProfile,
+ const Referrer&,
+ bool isHTMLDocument,
+ bool useLegacyBackgroundSizeShorthandBehavior,
+ ContentSecurityPolicyDisposition,
+ UseCounter*);
+
KURL m_baseURL;
String m_charset;
CSSParserMode m_mode;
@@ -92,8 +116,8 @@ class CORE_EXPORT CSSParserContext {
UseCounter* m_useCounter;
};
-CORE_EXPORT const CSSParserContext& strictCSSParserContext();
+CORE_EXPORT const CSSParserContext* strictCSSParserContext();
} // namespace blink
-#endif // CSSParserMode_h
+#endif // CSSParserContext_h

Powered by Google App Engine
This is Rietveld 408576698