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

Unified Diff: Source/core/css/resolver/MatchedPropertiesCache.cpp

Issue 273843003: [Oilpan]: Make StylePropertySet fully garbage collected. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add comment for ShareableElementData new Created 6 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
Index: Source/core/css/resolver/MatchedPropertiesCache.cpp
diff --git a/Source/core/css/resolver/MatchedPropertiesCache.cpp b/Source/core/css/resolver/MatchedPropertiesCache.cpp
index 469fa3c9c2fb3b0fc99395faa735e8ff61adf3db..e629a2e05d346eec6ea77b30710dff68b2a90a8f 100644
--- a/Source/core/css/resolver/MatchedPropertiesCache.cpp
+++ b/Source/core/css/resolver/MatchedPropertiesCache.cpp
@@ -54,8 +54,10 @@ void CachedMatchedProperties::clear()
}
MatchedPropertiesCache::MatchedPropertiesCache()
+#if !ENABLE(OILPAN)
: m_additionsSinceLastSweep(0)
, m_sweepTimer(this, &MatchedPropertiesCache::sweep)
+#endif
{
}
@@ -85,17 +87,19 @@ const CachedMatchedProperties* MatchedPropertiesCache::find(unsigned hash, const
void MatchedPropertiesCache::add(const RenderStyle* style, const RenderStyle* parentStyle, unsigned hash, const MatchResult& matchResult)
{
+#if !ENABLE(OILPAN)
static const unsigned maxAdditionsBetweenSweeps = 100;
if (++m_additionsSinceLastSweep >= maxAdditionsBetweenSweeps
&& !m_sweepTimer.isActive()) {
static const unsigned sweepTimeInSeconds = 60;
m_sweepTimer.startOneShot(sweepTimeInSeconds, FROM_HERE);
}
+#endif
ASSERT(hash);
Cache::AddResult addResult = m_cache.add(hash, nullptr);
if (addResult.isNewEntry)
- addResult.storedValue->value = adoptPtr(new CachedMatchedProperties);
+ addResult.storedValue->value = adoptPtrWillBeNoop(new CachedMatchedProperties);
CachedMatchedProperties* cacheItem = addResult.storedValue->value.get();
if (!addResult.isNewEntry)
@@ -111,7 +115,7 @@ void MatchedPropertiesCache::clear()
void MatchedPropertiesCache::clearViewportDependent()
{
- Vector<unsigned, 16> toRemove;
+ WillBeHeapVector<unsigned, 16> toRemove;
for (Cache::iterator it = m_cache.begin(); it != m_cache.end(); ++it) {
CachedMatchedProperties* cacheItem = it->value.get();
if (cacheItem->renderStyle->hasViewportUnits())
@@ -120,6 +124,7 @@ void MatchedPropertiesCache::clearViewportDependent()
m_cache.removeAll(toRemove);
}
+#if !ENABLE(OILPAN)
void MatchedPropertiesCache::sweep(Timer<MatchedPropertiesCache>*)
{
// Look for cache entries containing a style declaration with a single ref and remove them.
@@ -141,6 +146,7 @@ void MatchedPropertiesCache::sweep(Timer<MatchedPropertiesCache>*)
m_cache.removeAll(toRemove);
m_additionsSinceLastSweep = 0;
}
+#endif
bool MatchedPropertiesCache::isCacheable(const Element* element, const RenderStyle* style, const RenderStyle* parentStyle)
{
@@ -166,4 +172,9 @@ bool MatchedPropertiesCache::isCacheable(const Element* element, const RenderSty
return true;
}
+void MatchedPropertiesCache::trace(Visitor* visitor)
+{
+ visitor->trace(m_cache);
+}
+
}

Powered by Google App Engine
This is Rietveld 408576698