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

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

Issue 187473003: Revert of Oilpan: Use weak pointers in StyleSheetContents caches. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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/css/StyleSheetContents.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StyleEngine.cpp
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index 2de67f7ad04984c5061f54ba1091979247803928..f59a38e203d880478af6b41ac56e4eeaad749b46 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -54,28 +54,18 @@
using namespace HTMLNames;
-static WillBeHeapHashMap<AtomicString, RawPtrWillBeWeakMember<StyleSheetContents> >& textToSheetCache()
-{
- typedef WillBeHeapHashMap<AtomicString, RawPtrWillBeWeakMember<StyleSheetContents> > TextToSheetCache;
-#if ENABLE(OILPAN)
- DEFINE_STATIC_LOCAL(Persistent<TextToSheetCache>, cache, (new TextToSheetCache));
- return *cache;
-#else
+static HashMap<AtomicString, StyleSheetContents*>& textToSheetCache()
+{
+ typedef HashMap<AtomicString, StyleSheetContents*> TextToSheetCache;
DEFINE_STATIC_LOCAL(TextToSheetCache, cache, ());
return cache;
-#endif
-}
-
-static WillBeHeapHashMap<RawPtrWillBeWeakMember<StyleSheetContents>, AtomicString>& sheetToTextCache()
-{
- typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<StyleSheetContents>, AtomicString> SheetToTextCache;
-#if ENABLE(OILPAN)
- DEFINE_STATIC_LOCAL(Persistent<SheetToTextCache>, cache, (new SheetToTextCache));
- return *cache;
-#else
+}
+
+static HashMap<StyleSheetContents*, AtomicString>& sheetToTextCache()
+{
+ typedef HashMap<StyleSheetContents*, AtomicString> SheetToTextCache;
DEFINE_STATIC_LOCAL(SheetToTextCache, cache, ());
return cache;
-#endif
}
StyleEngine::StyleEngine(Document& document)
@@ -589,7 +579,7 @@
if (!e->document().inQuirksMode()) {
AtomicString textContent(text);
- WillBeHeapHashMap<AtomicString, RawPtrWillBeWeakMember<StyleSheetContents> >::AddResult result = textToSheetCache().add(textContent, RawPtrWillBeWeakMember<StyleSheetContents>(nullptr));
+ HashMap<AtomicString, StyleSheetContents*>::AddResult result = textToSheetCache().add(textContent, 0);
if (result.isNewEntry || !result.storedValue->value) {
styleSheet = StyleEngine::parseSheet(e, text, startPosition, createdByParser);
if (result.isNewEntry && styleSheet->contents()->maybeCacheable()) {
@@ -620,7 +610,7 @@
void StyleEngine::removeSheet(StyleSheetContents* contents)
{
- WillBeHeapHashMap<RawPtrWillBeWeakMember<StyleSheetContents>, AtomicString>::iterator it = sheetToTextCache().find(contents);
+ HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache().find(contents);
if (it == sheetToTextCache().end())
return;
« no previous file with comments | « Source/core/css/StyleSheetContents.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698