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

Unified Diff: Source/core/css/resolver/StyleResolver.h

Issue 24106007: Replace style sharing cousin list search with LRU (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
Index: Source/core/css/resolver/StyleResolver.h
diff --git a/Source/core/css/resolver/StyleResolver.h b/Source/core/css/resolver/StyleResolver.h
index 2a78cb7be7c4babb3ee4a4d7ecd6fcce08b3ac16..c86defaa19f215a26d55fc8eef60fd464ce2df88 100644
--- a/Source/core/css/resolver/StyleResolver.h
+++ b/Source/core/css/resolver/StyleResolver.h
@@ -36,6 +36,7 @@
#include "core/css/resolver/StyleBuilder.h"
#include "core/css/resolver/StyleResolverState.h"
#include "core/css/resolver/StyleResourceLoader.h"
+#include "wtf/Deque.h"
#include "wtf/HashMap.h"
#include "wtf/HashSet.h"
#include "wtf/RefPtr.h"
@@ -85,6 +86,9 @@ enum RuleMatchingBehavior {
MatchOnlyUserAgentRules,
};
+const unsigned styleSharingListSize = 40;
+typedef WTF::Deque<RefPtr<Element>, styleSharingListSize> StyleSharingList;
+
#undef STYLE_STATS
#ifdef STYLE_STATS
@@ -273,6 +277,13 @@ public:
const RuleFeatureSet& ruleFeatureSet() const { return m_features; }
+ StyleSharingList& styleSharingList() { return m_styleSharingList; }
+
+ bool elementCanShareStyle(Element*);
+
+ void addToStyleSharingList(Element*);
+ void clearStyleSharingList();
+
#ifdef STYLE_STATS
ALWAYS_INLINE static StyleSharingStats& styleSharingStats() { return m_styleSharingStats; }
#endif
@@ -356,6 +367,8 @@ private:
StyleResourceLoader m_styleResourceLoader;
+ StyleSharingList m_styleSharingList;
+
#ifdef STYLE_STATS
static StyleSharingStats m_styleSharingStats;
#endif

Powered by Google App Engine
This is Rietveld 408576698