Chromium Code Reviews| 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; |