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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserTokenRange.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 CSSParserTokenRange_h 5 #ifndef CSSParserTokenRange_h
6 #define CSSParserTokenRange_h 6 #define CSSParserTokenRange_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 "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
11 #include "wtf/Vector.h" 11 #include "wtf/Vector.h"
12 12
13 namespace blink { 13 namespace blink {
14 14
15 CORE_EXPORT extern const CSSParserToken& staticEOFToken; 15 CORE_EXPORT extern const CSSParserToken& staticEOFToken;
16 16
17 // A CSSParserTokenRange is an iterator over a subrange of a vector of CSSParser Tokens. 17 // A CSSParserTokenRange is an iterator over a subrange of a vector of CSSParser Tokens.
18 // Accessing outside of the range will return an endless stream of EOF tokens. 18 // Accessing outside of the range will return an endless stream of EOF tokens.
19 // This class refers to half-open intervals [first, last). 19 // This class refers to half-open intervals [first, last).
20 class CORE_EXPORT CSSParserTokenRange { 20 class CORE_EXPORT CSSParserTokenRange {
21 DISALLOW_NEW(); 21 DISALLOW_NEW();
22 public: 22 public:
23 CSSParserTokenRange(const Vector<CSSParserToken>& vector) 23 CSSParserTokenRange(const CSSParserToken* first, const CSSParserToken* last)
esprehn 2016/04/22 23:30:57 We could also use a template I suppose to allow in
Timothy Loh 2016/04/27 06:52:05 IIRC I set it up so that once you have a CSSParser
24 : m_first(vector.begin()) 24 : m_first(first)
25 , m_last(vector.end()) 25 , m_last(last)
26 { 26 {
27 } 27 }
28 28
29 // This should be called on a range with tokens returned by that range. 29 // This should be called on a range with tokens returned by that range.
30 CSSParserTokenRange makeSubRange(const CSSParserToken* first, const CSSParse rToken* last) const; 30 CSSParserTokenRange makeSubRange(const CSSParserToken* first, const CSSParse rToken* last) const;
31 31
32 bool atEnd() const { return m_first == m_last; } 32 bool atEnd() const { return m_first == m_last; }
33 const CSSParserToken* end() const { return m_last; } 33 const CSSParserToken* end() const { return m_last; }
34 34
35 const CSSParserToken& peek(unsigned offset = 0) const 35 const CSSParserToken& peek(unsigned offset = 0) const
(...skipping 28 matching lines...) Expand all
64 ++m_first; 64 ++m_first;
65 } 65 }
66 66
67 String serialize() const; 67 String serialize() const;
68 68
69 const CSSParserToken* begin() const { return m_first; } 69 const CSSParserToken* begin() const { return m_first; }
70 70
71 static void initStaticEOFToken(); 71 static void initStaticEOFToken();
72 72
73 private: 73 private:
74 CSSParserTokenRange(const CSSParserToken* first, const CSSParserToken* last)
75 : m_first(first)
76 , m_last(last)
77 { }
78
79 const CSSParserToken* m_first; 74 const CSSParserToken* m_first;
80 const CSSParserToken* m_last; 75 const CSSParserToken* m_last;
81 }; 76 };
82 77
83 } // namespace blink 78 } // namespace blink
84 79
85 #endif // CSSParserTokenRange_h 80 #endif // CSSParserTokenRange_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698