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

Unified Diff: Source/core/dom/PresentationAttributeStyle.cpp

Issue 273843003: [Oilpan]: Make StylePropertySet fully garbage collected. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix crash found by svg/custom/invisible-text-after-scrolling.xhtml 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/dom/PresentationAttributeStyle.cpp
diff --git a/Source/core/dom/PresentationAttributeStyle.cpp b/Source/core/dom/PresentationAttributeStyle.cpp
index dc2c1c95d3e6ada01bd15b18a7389f81dc6c6259..1ca886a3e2a9c26a29479ece860563f4fe371a06 100644
--- a/Source/core/dom/PresentationAttributeStyle.cpp
+++ b/Source/core/dom/PresentationAttributeStyle.cpp
@@ -57,18 +57,25 @@ static bool operator!=(const PresentationAttributeCacheKey& a, const Presentatio
return a.attributesAndValues != b.attributesAndValues;
}
-struct PresentationAttributeCacheEntry {
- WTF_MAKE_FAST_ALLOCATED;
+struct PresentationAttributeCacheEntry FINAL : public NoBaseWillBeGarbageCollectedFinalized<PresentationAttributeCacheEntry> {
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
public:
+ void trace(Visitor* visitor) { visitor->trace(value); }
+
PresentationAttributeCacheKey key;
- RefPtr<StylePropertySet> value;
+ RefPtrWillBeMember<StylePropertySet> value;
};
-typedef HashMap<unsigned, OwnPtr<PresentationAttributeCacheEntry>, AlreadyHashed> PresentationAttributeCache;
+typedef WillBeHeapHashMap<unsigned, OwnPtrWillBeMember<PresentationAttributeCacheEntry>, AlreadyHashed> PresentationAttributeCache;
static PresentationAttributeCache& presentationAttributeCache()
{
+#if ENABLE(OILPAN)
+ DEFINE_STATIC_LOCAL(Persistent<PresentationAttributeCache>, cache, (new PresentationAttributeCache()));
+ return *cache;
+#else
DEFINE_STATIC_LOCAL(PresentationAttributeCache, cache, ());
return cache;
+#endif // ENABLE(OILPAN)
haraken 2014/06/25 13:37:11 You can write: DEFINE_STATIC_LOCAL(OwnPtrWillBe
wibling-chromium 2014/06/26 09:31:00 Done.
wibling-chromium 2014/06/26 09:59:40 Actually this seems to not compile on the non-oilp
}
class PresentationAttributeCacheCleaner {
@@ -153,7 +160,7 @@ static unsigned computePresentationAttributeCacheHash(const PresentationAttribut
return WTF::pairIntHash(key.tagName->existingHash(), attributeHash);
}
-PassRefPtr<StylePropertySet> computePresentationAttributeStyle(Element& element)
+PassRefPtrWillBeRawPtr<StylePropertySet> computePresentationAttributeStyle(Element& element)
{
DEFINE_STATIC_LOCAL(PresentationAttributeCacheCleaner, cacheCleaner, ());
@@ -173,7 +180,7 @@ PassRefPtr<StylePropertySet> computePresentationAttributeStyle(Element& element)
cacheValue = 0;
}
- RefPtr<StylePropertySet> style;
+ RefPtrWillBeRawPtr<StylePropertySet> style;
haraken 2014/06/25 13:37:11 = nullptr;
wibling-chromium 2014/06/26 09:31:00 Done.
if (cacheHash && cacheValue->value) {
style = cacheValue->value->value;
cacheCleaner.didHitPresentationAttributeCache();
@@ -188,7 +195,7 @@ PassRefPtr<StylePropertySet> computePresentationAttributeStyle(Element& element)
if (!cacheHash || cacheValue->value)
return style.release();
- OwnPtr<PresentationAttributeCacheEntry> newEntry = adoptPtr(new PresentationAttributeCacheEntry);
+ OwnPtrWillBeRawPtr<PresentationAttributeCacheEntry> newEntry = adoptPtrWillBeNoop(new PresentationAttributeCacheEntry);
newEntry->key = cacheKey;
newEntry->value = style;

Powered by Google App Engine
This is Rietveld 408576698