| 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 16 matching lines...) Expand all Loading... |
| 27 #ifndef SKY_ENGINE_CORE_DOM_DOCUMENTSTYLESHEETCOLLECTOR_H_ | 27 #ifndef SKY_ENGINE_CORE_DOM_DOCUMENTSTYLESHEETCOLLECTOR_H_ |
| 28 #define SKY_ENGINE_CORE_DOM_DOCUMENTSTYLESHEETCOLLECTOR_H_ | 28 #define SKY_ENGINE_CORE_DOM_DOCUMENTSTYLESHEETCOLLECTOR_H_ |
| 29 | 29 |
| 30 #include "sky/engine/platform/heap/Handle.h" | 30 #include "sky/engine/platform/heap/Handle.h" |
| 31 #include "sky/engine/wtf/HashSet.h" | 31 #include "sky/engine/wtf/HashSet.h" |
| 32 #include "sky/engine/wtf/RefPtr.h" | 32 #include "sky/engine/wtf/RefPtr.h" |
| 33 #include "sky/engine/wtf/Vector.h" | 33 #include "sky/engine/wtf/Vector.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class Document; |
| 37 class CSSStyleSheet; | 38 class CSSStyleSheet; |
| 38 class Document; | |
| 39 class StyleSheet; | |
| 40 class StyleSheetCollection; | 39 class StyleSheetCollection; |
| 41 | 40 |
| 42 class DocumentStyleSheetCollector { | 41 class DocumentStyleSheetCollector { |
| 43 // This class contains references to two on-heap collections, therefore | 42 // This class contains references to two on-heap collections, therefore |
| 44 // it's unhealthy to have it anywhere but on the stack, where stack | 43 // it's unhealthy to have it anywhere but on the stack, where stack |
| 45 // scanning will keep them alive. | 44 // scanning will keep them alive. |
| 46 STACK_ALLOCATED(); | 45 STACK_ALLOCATED(); |
| 47 public: | 46 public: |
| 48 friend class ImportedDocumentStyleSheetCollector; | 47 friend class ImportedDocumentStyleSheetCollector; |
| 49 | 48 |
| 50 DocumentStyleSheetCollector(Vector<RefPtr<StyleSheet> >& sheetsForList, Vect
or<RefPtr<CSSStyleSheet> >& activeList, HashSet<RawPtr<Document> >&); | 49 DocumentStyleSheetCollector(Vector<RefPtr<CSSStyleSheet> >& sheetsForList, V
ector<RefPtr<CSSStyleSheet> >& activeList, HashSet<RawPtr<Document> >&); |
| 51 ~DocumentStyleSheetCollector(); | 50 ~DocumentStyleSheetCollector(); |
| 52 | 51 |
| 53 void appendActiveStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&); | 52 void appendActiveStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&); |
| 54 void appendActiveStyleSheet(CSSStyleSheet*); | 53 void appendActiveStyleSheet(CSSStyleSheet*); |
| 55 void appendSheetForList(StyleSheet*); | 54 void appendSheetForList(CSSStyleSheet*); |
| 56 | 55 |
| 57 bool hasVisited(Document* document) const { return m_visitedDocuments.contai
ns(document); } | 56 bool hasVisited(Document* document) const { return m_visitedDocuments.contai
ns(document); } |
| 58 void willVisit(Document* document) { m_visitedDocuments.add(document); } | 57 void willVisit(Document* document) { m_visitedDocuments.add(document); } |
| 59 | 58 |
| 60 private: | 59 private: |
| 61 Vector<RefPtr<StyleSheet> >& m_styleSheetsForStyleSheetList; | 60 Vector<RefPtr<CSSStyleSheet> >& m_styleSheetsForStyleSheetList; |
| 62 Vector<RefPtr<CSSStyleSheet> >& m_activeAuthorStyleSheets; | 61 Vector<RefPtr<CSSStyleSheet> >& m_activeAuthorStyleSheets; |
| 63 HashSet<RawPtr<Document> >& m_visitedDocuments; | 62 HashSet<RawPtr<Document> >& m_visitedDocuments; |
| 64 }; | 63 }; |
| 65 | 64 |
| 66 class ActiveDocumentStyleSheetCollector final : public DocumentStyleSheetCollect
or { | 65 class ActiveDocumentStyleSheetCollector final : public DocumentStyleSheetCollect
or { |
| 67 public: | 66 public: |
| 68 ActiveDocumentStyleSheetCollector(StyleSheetCollection&); | 67 ActiveDocumentStyleSheetCollector(StyleSheetCollection&); |
| 69 private: | 68 private: |
| 70 HashSet<RawPtr<Document> > m_visitedDocuments; | 69 HashSet<RawPtr<Document> > m_visitedDocuments; |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 class ImportedDocumentStyleSheetCollector final : public DocumentStyleSheetColle
ctor { | 72 class ImportedDocumentStyleSheetCollector final : public DocumentStyleSheetColle
ctor { |
| 74 public: | 73 public: |
| 75 ImportedDocumentStyleSheetCollector(DocumentStyleSheetCollector&, Vector<Ref
Ptr<StyleSheet> >&); | 74 ImportedDocumentStyleSheetCollector(DocumentStyleSheetCollector&, Vector<Ref
Ptr<CSSStyleSheet> >&); |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 } // namespace blink | 77 } // namespace blink |
| 79 | 78 |
| 80 #endif // SKY_ENGINE_CORE_DOM_DOCUMENTSTYLESHEETCOLLECTOR_H_ | 79 #endif // SKY_ENGINE_CORE_DOM_DOCUMENTSTYLESHEETCOLLECTOR_H_ |
| OLD | NEW |