| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/html/canvas/CanvasFontCache.h" | 5 #include "core/html/canvas/CanvasFontCache.h" |
| 6 | 6 |
| 7 #include "core/css/parser/CSSParser.h" | 7 #include "core/css/parser/CSSParser.h" |
| 8 #include "core/css/resolver/StyleResolver.h" | 8 #include "core/css/resolver/StyleResolver.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/style/ComputedStyle.h" | 10 #include "core/style/ComputedStyle.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 m_mainCachePurgePreventer.reset(); | 127 m_mainCachePurgePreventer.reset(); |
| 128 Platform::current()->currentThread()->removeTaskObserver(this); | 128 Platform::current()->currentThread()->removeTaskObserver(this); |
| 129 m_pruningScheduled = false; | 129 m_pruningScheduled = false; |
| 130 } | 130 } |
| 131 | 131 |
| 132 void CanvasFontCache::schedulePruningIfNeeded() { | 132 void CanvasFontCache::schedulePruningIfNeeded() { |
| 133 if (m_pruningScheduled) | 133 if (m_pruningScheduled) |
| 134 return; | 134 return; |
| 135 ASSERT(!m_mainCachePurgePreventer); | 135 ASSERT(!m_mainCachePurgePreventer); |
| 136 m_mainCachePurgePreventer = wrapUnique(new FontCachePurgePreventer); | 136 m_mainCachePurgePreventer = WTF::wrapUnique(new FontCachePurgePreventer); |
| 137 Platform::current()->currentThread()->addTaskObserver(this); | 137 Platform::current()->currentThread()->addTaskObserver(this); |
| 138 m_pruningScheduled = true; | 138 m_pruningScheduled = true; |
| 139 } | 139 } |
| 140 | 140 |
| 141 bool CanvasFontCache::isInCache(const String& fontString) { | 141 bool CanvasFontCache::isInCache(const String& fontString) { |
| 142 return m_fetchedFonts.find(fontString) != m_fetchedFonts.end(); | 142 return m_fetchedFonts.find(fontString) != m_fetchedFonts.end(); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void CanvasFontCache::pruneAll() { | 145 void CanvasFontCache::pruneAll() { |
| 146 m_fetchedFonts.clear(); | 146 m_fetchedFonts.clear(); |
| 147 m_fontLRUList.clear(); | 147 m_fontLRUList.clear(); |
| 148 m_fontsResolvedUsingDefaultStyle.clear(); | 148 m_fontsResolvedUsingDefaultStyle.clear(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 DEFINE_TRACE(CanvasFontCache) { | 151 DEFINE_TRACE(CanvasFontCache) { |
| 152 visitor->trace(m_fetchedFonts); | 152 visitor->trace(m_fetchedFonts); |
| 153 visitor->trace(m_document); | 153 visitor->trace(m_document); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |