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

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: review feedback 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
« no previous file with comments | « Source/core/dom/PresentationAttributeStyle.h ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/PresentationAttributeStyle.cpp
diff --git a/Source/core/dom/PresentationAttributeStyle.cpp b/Source/core/dom/PresentationAttributeStyle.cpp
index dc2c1c95d3e6ada01bd15b18a7389f81dc6c6259..cafde8c77fc3c7c44c93cffa907c69f586bbb0fa 100644
--- a/Source/core/dom/PresentationAttributeStyle.cpp
+++ b/Source/core/dom/PresentationAttributeStyle.cpp
@@ -57,18 +57,20 @@ 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()
{
- DEFINE_STATIC_LOCAL(PresentationAttributeCache, cache, ());
- return cache;
+ DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<PresentationAttributeCache>, cache, (adoptPtrWillBeNoop(new PresentationAttributeCache())));
+ return *cache;
}
class PresentationAttributeCacheCleaner {
@@ -153,7 +155,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 +175,7 @@ PassRefPtr<StylePropertySet> computePresentationAttributeStyle(Element& element)
cacheValue = 0;
}
- RefPtr<StylePropertySet> style;
+ RefPtrWillBeRawPtr<StylePropertySet> style = nullptr;
if (cacheHash && cacheValue->value) {
style = cacheValue->value->value;
cacheCleaner.didHitPresentationAttributeCache();
@@ -188,7 +190,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;
« no previous file with comments | « Source/core/dom/PresentationAttributeStyle.h ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698