| OLD | NEW |
| 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 Loading... |
| 28 class CORE_EXPORT Scope { | 28 class CORE_EXPORT Scope { |
| 29 DISALLOW_NEW(); | 29 DISALLOW_NEW(); |
| 30 | 30 |
| 31 public: | 31 public: |
| 32 Scope(const String&); | 32 Scope(const String&); |
| 33 Scope(const String&, CSSParserObserverWrapper&); // For the inspector | 33 Scope(const String&, CSSParserObserverWrapper&); // For the inspector |
| 34 | 34 |
| 35 CSSParserTokenRange tokenRange(); | 35 CSSParserTokenRange tokenRange(); |
| 36 unsigned tokenCount(); | 36 unsigned tokenCount(); |
| 37 | 37 |
| 38 std::unique_ptr<Vector<String>> releaseEscapedStrings() { |
| 39 return std::move(m_stringPool); |
| 40 } |
| 41 |
| 38 private: | 42 private: |
| 39 void storeString(const String& string) { m_stringPool.append(string); } | 43 void storeString(const String&); |
| 40 Vector<CSSParserToken, 32> m_tokens; | 44 Vector<CSSParserToken, 32> m_tokens; |
| 41 // We only allocate strings when escapes are used. | 45 |
| 42 Vector<String> m_stringPool; | 46 // We only allocate strings when escapes are used. This member is lazily |
| 47 // initialized. |
| 48 std::unique_ptr<Vector<String>> m_stringPool; |
| 43 String m_string; | 49 String m_string; |
| 44 | 50 |
| 45 friend class CSSTokenizer; | 51 friend class CSSTokenizer; |
| 46 }; | 52 }; |
| 47 | 53 |
| 48 private: | 54 private: |
| 49 CSSTokenizer(CSSTokenizerInputStream&, Scope&); | 55 CSSTokenizer(CSSTokenizerInputStream&, Scope&); |
| 50 | 56 |
| 51 CSSParserToken nextToken(); | 57 CSSParserToken nextToken(); |
| 52 | 58 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 static const CodePoint codePoints[]; | 120 static const CodePoint codePoints[]; |
| 115 | 121 |
| 116 Vector<CSSParserTokenType, 8> m_blockStack; | 122 Vector<CSSParserTokenType, 8> m_blockStack; |
| 117 CSSTokenizerInputStream& m_input; | 123 CSSTokenizerInputStream& m_input; |
| 118 Scope& m_scope; | 124 Scope& m_scope; |
| 119 }; | 125 }; |
| 120 | 126 |
| 121 } // namespace blink | 127 } // namespace blink |
| 122 | 128 |
| 123 #endif // CSSTokenizer_h | 129 #endif // CSSTokenizer_h |
| OLD | NEW |