OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CSSParserObserverWrapper_h | 5 #ifndef CSSParserObserverWrapper_h |
6 #define CSSParserObserverWrapper_h | 6 #define CSSParserObserverWrapper_h |
7 | 7 |
8 #include "core/css/parser/CSSParserObserver.h" | 8 #include "core/css/parser/CSSParserObserver.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class CSSParserObserverWrapper { | 12 class CSSParserObserverWrapper { |
13 public: | 13 public: |
14 CSSParserObserverWrapper(CSSParserObserver& observer) | 14 explicit CSSParserObserverWrapper(CSSParserObserver& observer) |
15 : m_observer(observer) | 15 : m_observer(observer) |
16 { } | 16 { } |
17 | 17 |
18 unsigned startOffset(const CSSParserTokenRange&); | 18 unsigned startOffset(const CSSParserTokenRange&); |
19 unsigned previousTokenStartOffset(const CSSParserTokenRange&); | 19 unsigned previousTokenStartOffset(const CSSParserTokenRange&); |
20 unsigned endOffset(const CSSParserTokenRange&); // Includes trailing comment s | 20 unsigned endOffset(const CSSParserTokenRange&); // Includes trailing comment s |
21 | 21 |
22 void skipCommentsBefore(const CSSParserTokenRange&, bool leaveDirectlyBefore ); | 22 void skipCommentsBefore(const CSSParserTokenRange&, bool leaveDirectlyBefore ); |
23 void yieldCommentsBefore(const CSSParserTokenRange&); | 23 void yieldCommentsBefore(const CSSParserTokenRange&); |
24 | 24 |
25 CSSParserObserver& observer() { return m_observer; } | 25 CSSParserObserver& observer() { return m_observer; } |
26 void addComment(unsigned startOffset, unsigned endOffset, unsigned tokensBef ore) | 26 void addComment(unsigned startOffset, unsigned endOffset, unsigned tokensBef ore) |
27 { | 27 { |
28 CommentPosition position = {startOffset, endOffset, tokensBefore}; | 28 CommentPosition position = {startOffset, endOffset, tokensBefore}; |
29 m_commentOffsets.append(position); | 29 m_commentOffsets.append(position); |
30 } | 30 } |
31 void addToken(unsigned startOffset) { m_tokenOffsets.append(startOffset); } | 31 void addToken(unsigned startOffset) { m_tokenOffsets.append(startOffset); } |
32 void finalizeConstruction(CSSParserToken* firstParserToken) | 32 void finalizeConstruction(CSSParserToken* firstParserToken) |
33 { | 33 { |
34 m_firstParserToken = firstParserToken; | 34 m_firstParserToken = firstParserToken; |
35 m_commentIterator = m_commentOffsets.begin(); | 35 m_commentIterator = m_commentOffsets.begin(); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 // Oilpan: CSSParserObserver is stack allocated and stack scanning will | |
40 // separately locate it. | |
41 GC_PLUGIN_IGNORE("509911") | |
39 CSSParserObserver& m_observer; | 42 CSSParserObserver& m_observer; |
haraken
2015/08/07 08:17:56
Shall we change this to a RawPtrWillBeMember? (I t
sof
2015/08/07 08:20:20
We can't - it's currently marked as STACK_ALLOCATE
haraken
2015/08/07 08:27:38
ah, understand. Maybe it would make more sense to
sof
2015/08/07 09:11:07
Stack references held by stack "hosts" are recogni
| |
40 Vector<unsigned> m_tokenOffsets; | 43 Vector<unsigned> m_tokenOffsets; |
41 CSSParserToken* m_firstParserToken; | 44 CSSParserToken* m_firstParserToken; |
42 | 45 |
43 struct CommentPosition { | 46 struct CommentPosition { |
44 unsigned startOffset; | 47 unsigned startOffset; |
45 unsigned endOffset; | 48 unsigned endOffset; |
46 unsigned tokensBefore; | 49 unsigned tokensBefore; |
47 }; | 50 }; |
48 | 51 |
49 Vector<CommentPosition> m_commentOffsets; | 52 Vector<CommentPosition> m_commentOffsets; |
50 Vector<CommentPosition>::iterator m_commentIterator; | 53 Vector<CommentPosition>::iterator m_commentIterator; |
51 }; | 54 }; |
52 | 55 |
53 } // namespace blink | 56 } // namespace blink |
54 | 57 |
55 #endif // CSSParserObserverWrapper_h | 58 #endif // CSSParserObserverWrapper_h |
OLD | NEW |