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

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

Issue 2014483003: Rename OwnPtr::clear() to reset() in core/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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"
(...skipping 22 matching lines...) Expand all
33 defaultFontDescription.setFamily(fontFamily); 33 defaultFontDescription.setFamily(fontFamily);
34 defaultFontDescription.setSpecifiedSize(defaultFontSize); 34 defaultFontDescription.setSpecifiedSize(defaultFontSize);
35 defaultFontDescription.setComputedSize(defaultFontSize); 35 defaultFontDescription.setComputedSize(defaultFontSize);
36 m_defaultFontStyle = ComputedStyle::create(); 36 m_defaultFontStyle = ComputedStyle::create();
37 m_defaultFontStyle->setFontDescription(defaultFontDescription); 37 m_defaultFontStyle->setFontDescription(defaultFontDescription);
38 m_defaultFontStyle->font().update(m_defaultFontStyle->font().getFontSelector ()); 38 m_defaultFontStyle->font().update(m_defaultFontStyle->font().getFontSelector ());
39 } 39 }
40 40
41 CanvasFontCache::~CanvasFontCache() 41 CanvasFontCache::~CanvasFontCache()
42 { 42 {
43 m_mainCachePurgePreventer.clear(); 43 m_mainCachePurgePreventer.reset();
44 if (m_pruningScheduled) { 44 if (m_pruningScheduled) {
45 Platform::current()->currentThread()->removeTaskObserver(this); 45 Platform::current()->currentThread()->removeTaskObserver(this);
46 } 46 }
47 } 47 }
48 48
49 unsigned CanvasFontCache::maxFonts() 49 unsigned CanvasFontCache::maxFonts()
50 { 50 {
51 return CanvasFontCacheMaxFonts; 51 return CanvasFontCacheMaxFonts;
52 } 52 }
53 53
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 void CanvasFontCache::didProcessTask() 118 void CanvasFontCache::didProcessTask()
119 { 119 {
120 ASSERT(m_pruningScheduled); 120 ASSERT(m_pruningScheduled);
121 ASSERT(m_mainCachePurgePreventer); 121 ASSERT(m_mainCachePurgePreventer);
122 while (m_fetchedFonts.size() > maxFonts()) { 122 while (m_fetchedFonts.size() > maxFonts()) {
123 m_fetchedFonts.remove(m_fontLRUList.first()); 123 m_fetchedFonts.remove(m_fontLRUList.first());
124 m_fontsResolvedUsingDefaultStyle.remove(m_fontLRUList.first()); 124 m_fontsResolvedUsingDefaultStyle.remove(m_fontLRUList.first());
125 m_fontLRUList.removeFirst(); 125 m_fontLRUList.removeFirst();
126 } 126 }
127 m_mainCachePurgePreventer.clear(); 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 { 133 {
134 if (m_pruningScheduled) 134 if (m_pruningScheduled)
135 return; 135 return;
136 ASSERT(!m_mainCachePurgePreventer); 136 ASSERT(!m_mainCachePurgePreventer);
137 m_mainCachePurgePreventer = adoptPtr(new FontCachePurgePreventer); 137 m_mainCachePurgePreventer = adoptPtr(new FontCachePurgePreventer);
(...skipping 13 matching lines...) Expand all
151 m_fontsResolvedUsingDefaultStyle.clear(); 151 m_fontsResolvedUsingDefaultStyle.clear();
152 } 152 }
153 153
154 DEFINE_TRACE(CanvasFontCache) 154 DEFINE_TRACE(CanvasFontCache)
155 { 155 {
156 visitor->trace(m_fetchedFonts); 156 visitor->trace(m_fetchedFonts);
157 visitor->trace(m_document); 157 visitor->trace(m_document);
158 } 158 }
159 159
160 } // namespace blink 160 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698