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

Side by Side Diff: third_party/WebKit/Source/core/css/FontFaceCache.cpp

Issue 1858753003: Remove RawPtr from core/css (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 1 /*
2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 29 matching lines...) Expand all
40 #include "wtf/text/AtomicString.h" 40 #include "wtf/text/AtomicString.h"
41 41
42 42
43 namespace blink { 43 namespace blink {
44 44
45 FontFaceCache::FontFaceCache() 45 FontFaceCache::FontFaceCache()
46 : m_version(0) 46 : m_version(0)
47 { 47 {
48 } 48 }
49 49
50 void FontFaceCache::add(CSSFontSelector* cssFontSelector, const StyleRuleFontFac e* fontFaceRule, RawPtr<FontFace> prpFontFace) 50 void FontFaceCache::add(CSSFontSelector* cssFontSelector, const StyleRuleFontFac e* fontFaceRule, FontFace* fontFace)
51 { 51 {
52 RawPtr<FontFace> fontFace = prpFontFace;
53 if (!m_styleRuleToFontFace.add(fontFaceRule, fontFace).isNewEntry) 52 if (!m_styleRuleToFontFace.add(fontFaceRule, fontFace).isNewEntry)
54 return; 53 return;
55 addFontFace(cssFontSelector, fontFace, true); 54 addFontFace(cssFontSelector, fontFace, true);
56 } 55 }
57 56
58 void FontFaceCache::addFontFace(CSSFontSelector* cssFontSelector, RawPtr<FontFac e> prpFontFace, bool cssConnected) 57 void FontFaceCache::addFontFace(CSSFontSelector* cssFontSelector, FontFace* font Face, bool cssConnected)
59 { 58 {
60 RawPtr<FontFace> fontFace = prpFontFace;
61
62 FamilyToTraitsMap::AddResult traitsResult = m_fontFaces.add(fontFace->family (), nullptr); 59 FamilyToTraitsMap::AddResult traitsResult = m_fontFaces.add(fontFace->family (), nullptr);
63 if (!traitsResult.storedValue->value) 60 if (!traitsResult.storedValue->value)
64 traitsResult.storedValue->value = new TraitsMap; 61 traitsResult.storedValue->value = new TraitsMap;
65 62
66 TraitsMap::AddResult segmentedFontFaceResult = traitsResult.storedValue->val ue->add(fontFace->traits().bitfield(), nullptr); 63 TraitsMap::AddResult segmentedFontFaceResult = traitsResult.storedValue->val ue->add(fontFace->traits().bitfield(), nullptr);
67 if (!segmentedFontFaceResult.storedValue->value) 64 if (!segmentedFontFaceResult.storedValue->value)
68 segmentedFontFaceResult.storedValue->value = CSSSegmentedFontFace::creat e(cssFontSelector, fontFace->traits()); 65 segmentedFontFaceResult.storedValue->value = CSSSegmentedFontFace::creat e(cssFontSelector, fontFace->traits());
69 66
70 segmentedFontFaceResult.storedValue->value->addFontFace(fontFace, cssConnect ed); 67 segmentedFontFaceResult.storedValue->value->addFontFace(fontFace, cssConnect ed);
71 if (cssConnected) 68 if (cssConnected)
(...skipping 15 matching lines...) Expand all
87 void FontFaceCache::removeFontFace(FontFace* fontFace, bool cssConnected) 84 void FontFaceCache::removeFontFace(FontFace* fontFace, bool cssConnected)
88 { 85 {
89 FamilyToTraitsMap::iterator fontFacesIter = m_fontFaces.find(fontFace->famil y()); 86 FamilyToTraitsMap::iterator fontFacesIter = m_fontFaces.find(fontFace->famil y());
90 if (fontFacesIter == m_fontFaces.end()) 87 if (fontFacesIter == m_fontFaces.end())
91 return; 88 return;
92 TraitsMap* familyFontFaces = fontFacesIter->value.get(); 89 TraitsMap* familyFontFaces = fontFacesIter->value.get();
93 90
94 TraitsMap::iterator familyFontFacesIter = familyFontFaces->find(fontFace->tr aits().bitfield()); 91 TraitsMap::iterator familyFontFacesIter = familyFontFaces->find(fontFace->tr aits().bitfield());
95 if (familyFontFacesIter == familyFontFaces->end()) 92 if (familyFontFacesIter == familyFontFaces->end())
96 return; 93 return;
97 RawPtr<CSSSegmentedFontFace> segmentedFontFace = familyFontFacesIter->value; 94 CSSSegmentedFontFace* segmentedFontFace = familyFontFacesIter->value;
98 95
99 segmentedFontFace->removeFontFace(fontFace); 96 segmentedFontFace->removeFontFace(fontFace);
100 if (segmentedFontFace->isEmpty()) { 97 if (segmentedFontFace->isEmpty()) {
101 familyFontFaces->remove(familyFontFacesIter); 98 familyFontFaces->remove(familyFontFacesIter);
102 if (familyFontFaces->isEmpty()) 99 if (familyFontFaces->isEmpty())
103 m_fontFaces.remove(fontFacesIter); 100 m_fontFaces.remove(fontFacesIter);
104 } 101 }
105 m_fonts.remove(fontFace->family()); 102 m_fonts.remove(fontFace->family());
106 if (cssConnected) 103 if (cssConnected)
107 m_cssConnectedFontFaces.remove(fontFace); 104 m_cssConnectedFontFaces.remove(fontFace);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 150
154 DEFINE_TRACE(FontFaceCache) 151 DEFINE_TRACE(FontFaceCache)
155 { 152 {
156 visitor->trace(m_fontFaces); 153 visitor->trace(m_fontFaces);
157 visitor->trace(m_fonts); 154 visitor->trace(m_fonts);
158 visitor->trace(m_styleRuleToFontFace); 155 visitor->trace(m_styleRuleToFontFace);
159 visitor->trace(m_cssConnectedFontFaces); 156 visitor->trace(m_cssConnectedFontFaces);
160 } 157 }
161 158
162 } // namespace blink 159 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/FontFaceCache.h ('k') | third_party/WebKit/Source/core/css/FontFaceSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698