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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSTokenizer.h

Issue 1920583002: NOT FOR LANDING: Hack up CSSParser for speed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing consts. Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CSSTokenizer_h 5 #ifndef CSSTokenizer_h
6 #define CSSTokenizer_h 6 #define CSSTokenizer_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/css/parser/CSSParserToken.h" 9 #include "core/css/parser/CSSParserToken.h"
10 #include "core/html/parser/InputStreamPreprocessor.h" 10 #include "core/html/parser/InputStreamPreprocessor.h"
(...skipping 17 matching lines...) Expand all
28 DISALLOW_NEW(); 28 DISALLOW_NEW();
29 public: 29 public:
30 Scope(const String&); 30 Scope(const String&);
31 Scope(const String&, CSSParserObserverWrapper&); // For the inspector 31 Scope(const String&, CSSParserObserverWrapper&); // For the inspector
32 32
33 CSSParserTokenRange tokenRange(); 33 CSSParserTokenRange tokenRange();
34 unsigned tokenCount(); 34 unsigned tokenCount();
35 35
36 private: 36 private:
37 void storeString(const String& string) { m_stringPool.append(string); } 37 void storeString(const String& string) { m_stringPool.append(string); }
38 Vector<CSSParserToken> m_tokens; 38 Vector<CSSParserToken, 32> m_tokens;
esprehn 2016/04/22 23:30:58 Lots of malloc in the profiles. By using inline ca
39 // We only allocate strings when escapes are used. 39 // We only allocate strings when escapes are used.
40 Vector<String> m_stringPool; 40 Vector<String> m_stringPool;
41 String m_string; 41 String m_string;
42 42
43 friend class CSSTokenizer; 43 friend class CSSTokenizer;
44 }; 44 };
45 45
46 private: 46 private:
47 CSSTokenizer(CSSTokenizerInputStream&, Scope&); 47 CSSTokenizer(CSSTokenizerInputStream&, Scope&);
48 48
(...skipping 24 matching lines...) Expand all
73 bool nextCharsAreNumber(); 73 bool nextCharsAreNumber();
74 bool nextCharsAreIdentifier(UChar); 74 bool nextCharsAreIdentifier(UChar);
75 bool nextCharsAreIdentifier(); 75 bool nextCharsAreIdentifier();
76 CSSParserToken blockStart(CSSParserTokenType); 76 CSSParserToken blockStart(CSSParserTokenType);
77 CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType, CSSParserString); 77 CSSParserToken blockStart(CSSParserTokenType blockType, CSSParserTokenType, CSSParserString);
78 CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType); 78 CSSParserToken blockEnd(CSSParserTokenType, CSSParserTokenType startType);
79 79
80 using CodePoint = CSSParserToken (CSSTokenizer::*)(UChar); 80 using CodePoint = CSSParserToken (CSSTokenizer::*)(UChar);
81 81
82 static const CodePoint codePoints[]; 82 static const CodePoint codePoints[];
83 Vector<CSSParserTokenType> m_blockStack; 83 Vector<CSSParserTokenType, 8> m_blockStack;
esprehn 2016/04/22 23:30:58 ditto
84 84
85 CSSParserToken whiteSpace(UChar); 85 CSSParserToken whiteSpace(UChar);
86 CSSParserToken leftParenthesis(UChar); 86 CSSParserToken leftParenthesis(UChar);
87 CSSParserToken rightParenthesis(UChar); 87 CSSParserToken rightParenthesis(UChar);
88 CSSParserToken leftBracket(UChar); 88 CSSParserToken leftBracket(UChar);
89 CSSParserToken rightBracket(UChar); 89 CSSParserToken rightBracket(UChar);
90 CSSParserToken leftBrace(UChar); 90 CSSParserToken leftBrace(UChar);
91 CSSParserToken rightBrace(UChar); 91 CSSParserToken rightBrace(UChar);
92 CSSParserToken plusOrFullStop(UChar); 92 CSSParserToken plusOrFullStop(UChar);
93 CSSParserToken comma(UChar); 93 CSSParserToken comma(UChar);
(...skipping 20 matching lines...) Expand all
114 114
115 CSSTokenizerInputStream& m_input; 115 CSSTokenizerInputStream& m_input;
116 Scope& m_scope; 116 Scope& m_scope;
117 }; 117 };
118 118
119 119
120 120
121 } // namespace blink 121 } // namespace blink
122 122
123 #endif // CSSTokenizer_h 123 #endif // CSSTokenizer_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698