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

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

Issue 2100573002: Avoid copying strings when parsing CSS colors on the slow path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing else. Created 4 years, 6 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 CSSTokenizerInputStream_h 5 #ifndef CSSTokenizerInputStream_h
6 #define CSSTokenizerInputStream_h 6 #define CSSTokenizerInputStream_h
7 7
8 #include "wtf/text/StringView.h" 8 #include "wtf/text/StringView.h"
9 #include "wtf/text/WTFString.h" 9 #include "wtf/text/WTFString.h"
10 10
(...skipping 26 matching lines...) Expand all
37 double getDouble(unsigned start, unsigned end); 37 double getDouble(unsigned start, unsigned end);
38 38
39 template<bool characterPredicate(UChar)> 39 template<bool characterPredicate(UChar)>
40 unsigned skipWhilePredicate(unsigned offset) 40 unsigned skipWhilePredicate(unsigned offset)
41 { 41 {
42 while ((m_offset + offset) < m_stringLength && characterPredicate((*m_st ring)[m_offset + offset])) 42 while ((m_offset + offset) < m_stringLength && characterPredicate((*m_st ring)[m_offset + offset]))
43 ++offset; 43 ++offset;
44 return offset; 44 return offset;
45 } 45 }
46 46
47 unsigned length() const { return m_stringLength; }
47 unsigned offset() const { return std::min(m_offset, m_stringLength); } 48 unsigned offset() const { return std::min(m_offset, m_stringLength); }
48 StringView rangeAt(unsigned start, unsigned length) const; 49 StringView rangeAt(unsigned start, unsigned length) const;
49 50
50 private: 51 private:
51 size_t m_offset; 52 size_t m_offset;
52 const size_t m_stringLength; 53 const size_t m_stringLength;
53 const RefPtr<StringImpl> m_string; 54 const RefPtr<StringImpl> m_string;
54 }; 55 };
55 56
56 } // namespace blink 57 } // namespace blink
57 58
58 #endif // CSSTokenizerInputStream_h 59 #endif // CSSTokenizerInputStream_h
59 60
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698