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

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

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: esprehn review Created 4 years, 2 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/CSSLazyParsingState.h
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h
new file mode 100644
index 0000000000000000000000000000000000000000..40772183fa12d273c386194fa646cf51cfd4f22f
--- /dev/null
+++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.h
@@ -0,0 +1,41 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CSSLazyParsingState_h
+#define CSSLazyParsingState_h
+
+#include "core/css/CSSSelectorList.h"
+#include "core/css/parser/CSSParserMode.h"
+#include "wtf/Vector.h"
+#include "wtf/text/WTFString.h"
+
+namespace blink {
+
+// This class helps lazy parsing by retaining necessary state. It should not
+// outlive the StyleSheetContents that initiated the parse, as it retains a raw
+// reference to the UseCounter associated with the style sheet.
+class CSSLazyParsingState
+ : public GarbageCollectedFinalized<CSSLazyParsingState> {
+ public:
+ CSSLazyParsingState(const CSSParserContext&,
+ Vector<String> escapedStrings,
+ const String& sheetText);
+
+ // This should be a copy of the context used in CSSParser::parseSheet.
+ const CSSParserContext& context() { return m_context; }
+
+ bool shouldLazilyParseProperties(const CSSSelectorList&);
+
+ DEFINE_INLINE_TRACE() {}
+
+ private:
+ CSSParserContext m_context;
+ Vector<String> m_escapedStrings;
+ // Also referenced on the css resource.
+ String m_sheetText;
+};
+
+} // namespace blink
+
+#endif // CSSLazyParsingState_h

Powered by Google App Engine
This is Rietveld 408576698