Chromium Code Reviews| Index: Source/core/dom/Document.h |
| diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h |
| index 51a3c60befaffd8c8722eedee272a4a7ce04c092..bf14e6dbb835fbc03e33beceabca0fa03b59cbdb 100644 |
| --- a/Source/core/dom/Document.h |
| +++ b/Source/core/dom/Document.h |
| @@ -128,6 +128,7 @@ class MediaQueryListListener; |
| class MediaQueryMatcher; |
| class NodeFilter; |
| class NodeIterator; |
| +class NthIndexCache; |
| class Page; |
| class PlatformMouseEvent; |
| class ProcessingInstruction; |
| @@ -247,6 +248,7 @@ public: |
| virtual bool canContainRangeEndPoint() const override { return true; } |
| SelectorQueryCache& selectorQueryCache(); |
| + NthIndexCache* nthIndexCache(); |
| // Focus Management. |
| Element* activeElement() const; |
| @@ -1061,6 +1063,25 @@ public: |
| OriginsUsingFeatures::Value& originsUsingFeaturesValue() { return m_originsUsingFeaturesValue; } |
| + class UseNthIndexCacheScope { |
| + STACK_ALLOCATED(); |
| + WTF_MAKE_NONCOPYABLE(UseNthIndexCacheScope); |
| + public: |
| + UseNthIndexCacheScope(Document& document) |
| + : m_document(&document) |
| + { |
| + ASSERT(!document.useNthIndexCache()); |
|
sof
2015/03/30 13:27:53
Just to verify: there's no possibility that you ma
rune
2015/03/30 20:14:40
Shouldn't with the current uses of this scope. que
|
| + document.setUseNthIndexCache(true); |
| + } |
| + ~UseNthIndexCacheScope() |
| + { |
| + ASSERT(m_document->useNthIndexCache()); |
| + m_document->setUseNthIndexCache(false); |
| + } |
| + private: |
| + RawPtrWillBeMember<Document> m_document; |
| + }; |
| + |
| protected: |
| Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass); |
| @@ -1317,6 +1338,7 @@ private: |
| WillBeHeapHashMap<String, RefPtrWillBeMember<HTMLCanvasElement>> m_cssCanvasElements; |
| OwnPtr<SelectorQueryCache> m_selectorQueryCache; |
| + OwnPtrWillBeMember<NthIndexCache> m_nthIndexCache; |
| bool m_useSecureKeyboardEntryWhenActive; |
| @@ -1397,6 +1419,11 @@ private: |
| ParserSynchronizationPolicy m_parserSyncPolicy; |
| OriginsUsingFeatures::Value m_originsUsingFeaturesValue; |
| + |
| + bool useNthIndexCache() const { return m_useNthIndexCache; } |
| + void setUseNthIndexCache(bool); |
| + |
| + bool m_useNthIndexCache; |
| }; |
| inline bool Document::shouldOverrideLegacyDescription(ViewportDescription::Type origin) |