OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 10 matching lines...) Expand all Loading... |
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef DocumentStyleSheetCollector_h | 27 #ifndef DocumentStyleSheetCollector_h |
28 #define DocumentStyleSheetCollector_h | 28 #define DocumentStyleSheetCollector_h |
29 | 29 |
30 #include "bindings/core/v8/TraceWrapperMember.h" | 30 #include "bindings/core/v8/TraceWrapperMember.h" |
| 31 #include "core/css/ActiveStyleSheets.h" |
31 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
32 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
33 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
34 | 35 |
35 namespace blink { | 36 namespace blink { |
36 | 37 |
37 class CSSStyleSheet; | |
38 class Document; | 38 class Document; |
39 class StyleSheet; | 39 class StyleSheet; |
40 class StyleSheetCollection; | 40 class StyleSheetCollection; |
41 | 41 |
42 class DocumentStyleSheetCollector { | 42 class DocumentStyleSheetCollector { |
43 // This class contains references to two on-heap collections, therefore | 43 // This class contains references to two on-heap collections, therefore |
44 // it's unhealthy to have it anywhere but on the stack, where stack | 44 // it's unhealthy to have it anywhere but on the stack, where stack |
45 // scanning will keep them alive. | 45 // scanning will keep them alive. |
46 STACK_ALLOCATED(); | 46 STACK_ALLOCATED(); |
47 | 47 |
48 public: | 48 public: |
49 friend class ImportedDocumentStyleSheetCollector; | 49 friend class ImportedDocumentStyleSheetCollector; |
50 | 50 |
51 DocumentStyleSheetCollector(StyleSheetCollection*, | 51 DocumentStyleSheetCollector(StyleSheetCollection*, |
52 HeapVector<Member<StyleSheet>>*, | 52 HeapVector<Member<StyleSheet>>*, |
53 HeapHashSet<Member<Document>>*); | 53 HeapHashSet<Member<Document>>*); |
54 ~DocumentStyleSheetCollector(); | 54 ~DocumentStyleSheetCollector(); |
55 | 55 |
56 void appendActiveStyleSheets( | 56 void appendActiveStyleSheet(const ActiveStyleSheet&); |
57 const HeapVector<TraceWrapperMember<CSSStyleSheet>>&); | |
58 void appendActiveStyleSheet(CSSStyleSheet*); | |
59 void appendSheetForList(StyleSheet*); | 57 void appendSheetForList(StyleSheet*); |
60 | 58 |
61 bool hasVisited(Document* document) const { | 59 bool hasVisited(Document* document) const { |
62 return m_visitedDocuments->contains(document); | 60 return m_visitedDocuments->contains(document); |
63 } | 61 } |
64 void willVisit(Document* document) { m_visitedDocuments->add(document); } | 62 void willVisit(Document* document) { m_visitedDocuments->add(document); } |
65 | 63 |
66 private: | 64 private: |
67 Member<StyleSheetCollection> m_collection; | 65 Member<StyleSheetCollection> m_collection; |
68 HeapVector<Member<StyleSheet>>* m_styleSheetsForStyleSheetList; | 66 HeapVector<Member<StyleSheet>>* m_styleSheetsForStyleSheetList; |
(...skipping 12 matching lines...) Expand all Loading... |
81 class ImportedDocumentStyleSheetCollector final | 79 class ImportedDocumentStyleSheetCollector final |
82 : public DocumentStyleSheetCollector { | 80 : public DocumentStyleSheetCollector { |
83 public: | 81 public: |
84 ImportedDocumentStyleSheetCollector(DocumentStyleSheetCollector&, | 82 ImportedDocumentStyleSheetCollector(DocumentStyleSheetCollector&, |
85 HeapVector<Member<StyleSheet>>&); | 83 HeapVector<Member<StyleSheet>>&); |
86 }; | 84 }; |
87 | 85 |
88 } // namespace blink | 86 } // namespace blink |
89 | 87 |
90 #endif // DocumentStyleSheetCollector_h | 88 #endif // DocumentStyleSheetCollector_h |
OLD | NEW |