| Index: Source/core/dom/StyleEngine.cpp
|
| diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
|
| index f59a38e203d880478af6b41ac56e4eeaad749b46..2de67f7ad04984c5061f54ba1091979247803928 100644
|
| --- a/Source/core/dom/StyleEngine.cpp
|
| +++ b/Source/core/dom/StyleEngine.cpp
|
| @@ -54,18 +54,28 @@ namespace WebCore {
|
|
|
| using namespace HTMLNames;
|
|
|
| -static HashMap<AtomicString, StyleSheetContents*>& textToSheetCache()
|
| +static WillBeHeapHashMap<AtomicString, RawPtrWillBeWeakMember<StyleSheetContents> >& textToSheetCache()
|
| {
|
| - typedef HashMap<AtomicString, StyleSheetContents*> TextToSheetCache;
|
| + typedef WillBeHeapHashMap<AtomicString, RawPtrWillBeWeakMember<StyleSheetContents> > TextToSheetCache;
|
| +#if ENABLE(OILPAN)
|
| + DEFINE_STATIC_LOCAL(Persistent<TextToSheetCache>, cache, (new TextToSheetCache));
|
| + return *cache;
|
| +#else
|
| DEFINE_STATIC_LOCAL(TextToSheetCache, cache, ());
|
| return cache;
|
| +#endif
|
| }
|
|
|
| -static HashMap<StyleSheetContents*, AtomicString>& sheetToTextCache()
|
| +static WillBeHeapHashMap<RawPtrWillBeWeakMember<StyleSheetContents>, AtomicString>& sheetToTextCache()
|
| {
|
| - typedef HashMap<StyleSheetContents*, AtomicString> SheetToTextCache;
|
| + typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<StyleSheetContents>, AtomicString> SheetToTextCache;
|
| +#if ENABLE(OILPAN)
|
| + DEFINE_STATIC_LOCAL(Persistent<SheetToTextCache>, cache, (new SheetToTextCache));
|
| + return *cache;
|
| +#else
|
| DEFINE_STATIC_LOCAL(SheetToTextCache, cache, ());
|
| return cache;
|
| +#endif
|
| }
|
|
|
| StyleEngine::StyleEngine(Document& document)
|
| @@ -579,7 +589,7 @@ PassRefPtr<CSSStyleSheet> StyleEngine::createSheet(Element* e, const String& tex
|
| if (!e->document().inQuirksMode()) {
|
| AtomicString textContent(text);
|
|
|
| - HashMap<AtomicString, StyleSheetContents*>::AddResult result = textToSheetCache().add(textContent, 0);
|
| + WillBeHeapHashMap<AtomicString, RawPtrWillBeWeakMember<StyleSheetContents> >::AddResult result = textToSheetCache().add(textContent, RawPtrWillBeWeakMember<StyleSheetContents>(nullptr));
|
| if (result.isNewEntry || !result.storedValue->value) {
|
| styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByParser);
|
| if (result.isNewEntry && styleSheet->contents()->maybeCacheable()) {
|
| @@ -610,7 +620,7 @@ PassRefPtr<CSSStyleSheet> StyleEngine::parseSheet(Element* e, const String& text
|
|
|
| void StyleEngine::removeSheet(StyleSheetContents* contents)
|
| {
|
| - HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache().find(contents);
|
| + WillBeHeapHashMap<RawPtrWillBeWeakMember<StyleSheetContents>, AtomicString>::iterator it = sheetToTextCache().find(contents);
|
| if (it == sheetToTextCache().end())
|
| return;
|
|
|
|
|