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

Unified Diff: Source/core/dom/Document.h

Issue 1023393002: Cache element indices for :nth-child and :nth-last-child selectors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missing initializer and incorrect assert. Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.h
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index c832a24fbfaaf5621989d0c0e69e24480a4b721c..89d1fb7a6d7b1a704eb21bf0c220d6c2c00fc292 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -129,6 +129,7 @@ class MediaQueryListListener;
class MediaQueryMatcher;
class NodeFilter;
class NodeIterator;
+class NthIndexCache;
class Page;
class PlatformMouseEvent;
class ProcessingInstruction;
@@ -1061,6 +1062,8 @@ public:
OriginsUsingFeatures::Value& originsUsingFeaturesValue() { return m_originsUsingFeaturesValue; }
+ NthIndexCache* nthIndexCache() const { return m_nthIndexCache; }
+
protected:
Document(const DocumentInit&, DocumentClassFlags = DefaultDocumentClass);
@@ -1080,6 +1083,7 @@ protected:
private:
friend class IgnoreDestructiveWriteCountIncrementer;
+ friend class NthIndexCache;
bool isDocumentFragment() const = delete; // This will catch anyone doing an unnecessary check.
bool isDocumentNode() const = delete; // This will catch anyone doing an unnecessary check.
@@ -1172,6 +1176,8 @@ private:
void updateElementOpacity(const AtomicString& cssSelector, double opacity);
+ void setNthIndexCache(NthIndexCache* nthIndexCache) { ASSERT(!m_nthIndexCache || !nthIndexCache); m_nthIndexCache = nthIndexCache; }
+
DocumentLifecycle m_lifecycle;
bool m_hasNodesWithPlaceholderStyle;
@@ -1318,6 +1324,14 @@ private:
OwnPtr<SelectorQueryCache> m_selectorQueryCache;
+ // It is safe to keep a raw, untraced pointer to this stack-allocated
+ // cache object: it is set upon the cache object being allocated on
+ // the stack and cleared upon leaving its allocated scope. Hence it
+ // is acceptable not to trace it -- should a conservative GC occur,
+ // the cache object's references will be traced by a stack walk.
+ GC_PLUGIN_IGNORE("461878")
+ NthIndexCache* m_nthIndexCache = nullptr;
+
bool m_useSecureKeyboardEntryWhenActive;
DocumentClassFlags m_documentClasses;
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698