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

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

Issue 1162533005: Stop sorting StyleEngine::m_activeTreeScopes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StyleEngine.h
diff --git a/Source/core/dom/StyleEngine.h b/Source/core/dom/StyleEngine.h
index ffe7ae975ae10cf81d7b82192fab07cd3e2455f7..c7621823000638564efbe61495ac885631c85ae2 100644
--- a/Source/core/dom/StyleEngine.h
+++ b/Source/core/dom/StyleEngine.h
@@ -201,49 +201,7 @@ private:
typedef WillBeHeapHashSet<RawPtrWillBeMember<TreeScope>> UnorderedTreeScopeSet;
- // A class which holds document-ordered treescopes which have stylesheets.
- // ListHashSet allows only sequential access, not random access.
- // So it gets slow when the size of treescopes gets larger when finding
- // the best place to insert a treescope into the document-ordered
- // treescopes (requires linear search).
- // To solve this, use a vector for the document-ordered treescopes and
- // use a hashset for quickly checking whether a given treescope is
- // in the document-ordered treescopes or not.
- class OrderedTreeScopeSet final {
- DISALLOW_ALLOCATION();
- WTF_MAKE_NONCOPYABLE(OrderedTreeScopeSet);
- public:
- OrderedTreeScopeSet() { }
-
- void insert(TreeScope*);
- void remove(TreeScope*);
-
- // When we don't need to consider document-order, use this iterator.
- // Otherwise, use [] operator.
- UnorderedTreeScopeSet::iterator beginUnordered() { return m_hash.begin(); }
- UnorderedTreeScopeSet::iterator endUnordered() { return m_hash.end(); }
-
- bool isEmpty() const { return m_treeScopes.isEmpty(); }
- void clear()
- {
- m_treeScopes.clear();
- m_hash.clear();
- }
-
- size_t size() const { return m_treeScopes.size(); }
-
- TreeScope* operator[](size_t i) { return m_treeScopes[i]; }
- const TreeScope* operator[](size_t i) const { return m_treeScopes[i]; }
-
- DECLARE_TRACE();
-
- private:
- WillBeHeapVector<RawPtrWillBeMember<TreeScope>, 16> m_treeScopes;
- UnorderedTreeScopeSet m_hash;
- };
-
- static void insertTreeScopeInDocumentOrder(OrderedTreeScopeSet&, TreeScope*);
- void clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScopeSet::iterator begin, UnorderedTreeScopeSet::iterator end);
+ void clearMediaQueryRuleSetOnTreeScopeStyleSheets(UnorderedTreeScopeSet&);
void createResolver();
@@ -279,7 +237,7 @@ private:
bool m_documentScopeDirty;
UnorderedTreeScopeSet m_dirtyTreeScopes;
- OrderedTreeScopeSet m_activeTreeScopes;
+ UnorderedTreeScopeSet m_activeTreeScopes;
String m_preferredStylesheetSetName;
String m_selectedStylesheetSetName;
« no previous file with comments | « no previous file | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698