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

Side by Side Diff: third_party/WebKit/Source/core/html/canvas/CanvasFontCache.cpp

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 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 unified diff | Download patch
OLDNEW
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"
11 #include "platform/fonts/FontCache.h" 11 #include "platform/fonts/FontCache.h"
12 #include "public/platform/Platform.h" 12 #include "public/platform/Platform.h"
13 #include "wtf/PtrUtil.h"
13 14
14 namespace { 15 namespace {
15 16
16 const unsigned CanvasFontCacheMaxFonts = 50; 17 const unsigned CanvasFontCacheMaxFonts = 50;
17 const unsigned CanvasFontCacheHardMaxFonts = 250; 18 const unsigned CanvasFontCacheHardMaxFonts = 250;
18 const unsigned CanvasFontCacheHiddenMaxFonts = 1; 19 const unsigned CanvasFontCacheHiddenMaxFonts = 1;
19 const int defaultFontSize = 10; 20 const int defaultFontSize = 10;
20 const char defaultFontFamily[] = "sans-serif"; 21 const char defaultFontFamily[] = "sans-serif";
21 22
22 } 23 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 m_mainCachePurgePreventer.reset(); 128 m_mainCachePurgePreventer.reset();
128 Platform::current()->currentThread()->removeTaskObserver(this); 129 Platform::current()->currentThread()->removeTaskObserver(this);
129 m_pruningScheduled = false; 130 m_pruningScheduled = false;
130 } 131 }
131 132
132 void CanvasFontCache::schedulePruningIfNeeded() 133 void CanvasFontCache::schedulePruningIfNeeded()
133 { 134 {
134 if (m_pruningScheduled) 135 if (m_pruningScheduled)
135 return; 136 return;
136 ASSERT(!m_mainCachePurgePreventer); 137 ASSERT(!m_mainCachePurgePreventer);
137 m_mainCachePurgePreventer = adoptPtr(new FontCachePurgePreventer); 138 m_mainCachePurgePreventer = wrapUnique(new FontCachePurgePreventer);
138 Platform::current()->currentThread()->addTaskObserver(this); 139 Platform::current()->currentThread()->addTaskObserver(this);
139 m_pruningScheduled = true; 140 m_pruningScheduled = true;
140 } 141 }
141 142
142 bool CanvasFontCache::isInCache(const String& fontString) 143 bool CanvasFontCache::isInCache(const String& fontString)
143 { 144 {
144 return m_fetchedFonts.find(fontString) != m_fetchedFonts.end(); 145 return m_fetchedFonts.find(fontString) != m_fetchedFonts.end();
145 } 146 }
146 147
147 void CanvasFontCache::pruneAll() 148 void CanvasFontCache::pruneAll()
148 { 149 {
149 m_fetchedFonts.clear(); 150 m_fetchedFonts.clear();
150 m_fontLRUList.clear(); 151 m_fontLRUList.clear();
151 m_fontsResolvedUsingDefaultStyle.clear(); 152 m_fontsResolvedUsingDefaultStyle.clear();
152 } 153 }
153 154
154 DEFINE_TRACE(CanvasFontCache) 155 DEFINE_TRACE(CanvasFontCache)
155 { 156 {
156 visitor->trace(m_fetchedFonts); 157 visitor->trace(m_fetchedFonts);
157 visitor->trace(m_document); 158 visitor->trace(m_document);
158 } 159 }
159 160
160 } // namespace blink 161 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698