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

Side by Side Diff: src/fonts/SkFontMgr_indirect.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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
« no previous file with comments | « src/fonts/SkFontMgr_fontconfig.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDataTable.h" 8 #include "SkDataTable.h"
9 #include "SkFontMgr.h" 9 #include "SkFontMgr.h"
10 #include "SkFontMgr_indirect.h" 10 #include "SkFontMgr_indirect.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (entry.fTypeface->weak_expired()) { 118 if (entry.fTypeface->weak_expired()) {
119 fDataCache.removeShuffle(i); 119 fDataCache.removeShuffle(i);
120 --i; 120 --i;
121 } 121 }
122 } 122 }
123 123
124 // No exact match, but did find a data match. 124 // No exact match, but did find a data match.
125 if (dataTypeface.get() != nullptr) { 125 if (dataTypeface.get() != nullptr) {
126 SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(nullptr)); 126 SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(nullptr));
127 if (stream.get() != nullptr) { 127 if (stream.get() != nullptr) {
128 return fImpl->createFromStream(stream.detach(), dataTypefaceIndex); 128 return fImpl->createFromStream(stream.release(), dataTypefaceIndex);
129 } 129 }
130 } 130 }
131 131
132 // No data match, request data and add entry. 132 // No data match, request data and add entry.
133 SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId)); 133 SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId));
134 if (stream.get() == nullptr) { 134 if (stream.get() == nullptr) {
135 return nullptr; 135 return nullptr;
136 } 136 }
137 137
138 SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.detach(), i d.fTtcIndex)); 138 SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.release(), id.fTtcIndex));
139 if (typeface.get() == nullptr) { 139 if (typeface.get() == nullptr) {
140 return nullptr; 140 return nullptr;
141 } 141 }
142 142
143 DataEntry& newEntry = fDataCache.push_back(); 143 DataEntry& newEntry = fDataCache.push_back();
144 typeface->weak_ref(); 144 typeface->weak_ref();
145 newEntry.fDataId = id.fDataId; 145 newEntry.fDataId = id.fDataId;
146 newEntry.fTtcIndex = id.fTtcIndex; 146 newEntry.fTtcIndex = id.fTtcIndex;
147 newEntry.fTypeface = typeface.get(); // weak reference passed to new entry. 147 newEntry.fTypeface = typeface.get(); // weak reference passed to new entry.
148 148
149 return typeface.detach(); 149 return typeface.release();
150 } 150 }
151 151
152 SkTypeface* SkFontMgr_Indirect::onMatchFamilyStyle(const char familyName[], 152 SkTypeface* SkFontMgr_Indirect::onMatchFamilyStyle(const char familyName[],
153 const SkFontStyle& fontStyle) const { 153 const SkFontStyle& fontStyle) const {
154 SkFontIdentity id = fProxy->matchNameStyle(familyName, fontStyle); 154 SkFontIdentity id = fProxy->matchNameStyle(familyName, fontStyle);
155 return this->createTypefaceFromFontId(id); 155 return this->createTypefaceFromFontId(id);
156 } 156 }
157 157
158 SkTypeface* SkFontMgr_Indirect::onMatchFamilyStyleCharacter(const char familyNam e[], 158 SkTypeface* SkFontMgr_Indirect::onMatchFamilyStyleCharacter(const char familyNam e[],
159 const SkFontStyle& s tyle, 159 const SkFontStyle& s tyle,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 if (nullptr == face.get()) { 199 if (nullptr == face.get()) {
200 face.reset(this->matchFamilyStyle(nullptr, style)); 200 face.reset(this->matchFamilyStyle(nullptr, style));
201 } 201 }
202 202
203 if (nullptr == face.get()) { 203 if (nullptr == face.get()) {
204 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); 204 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style);
205 face.reset(this->createTypefaceFromFontId(fontId)); 205 face.reset(this->createTypefaceFromFontId(fontId));
206 } 206 }
207 207
208 return face.detach(); 208 return face.release();
209 } 209 }
OLDNEW
« no previous file with comments | « src/fonts/SkFontMgr_fontconfig.cpp ('k') | src/gpu/GrClipMaskManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698