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

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

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. Created 5 years, 11 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/gl/GrGLPathRendering.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 "SkFontMgr_indirect.h" 8 #include "SkFontMgr_indirect.h"
9 9
10 #include "SkDataTable.h" 10 #include "SkDataTable.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 207
208 if (entry.fTypeface->weak_expired()) { 208 if (entry.fTypeface->weak_expired()) {
209 fDataCache.removeShuffle(i); 209 fDataCache.removeShuffle(i);
210 --i; 210 --i;
211 } 211 }
212 } 212 }
213 213
214 // No exact match, but did find a data match. 214 // No exact match, but did find a data match.
215 if (dataTypeface.get() != NULL) { 215 if (dataTypeface.get() != NULL) {
216 SkAutoTUnref<SkStream> stream(dataTypeface->openStream(NULL)); 216 SkAutoTDelete<SkStream> stream(dataTypeface->openStream(NULL));
217 if (stream.get() != NULL) { 217 if (stream.get() != NULL) {
218 return fImpl->createFromStream(stream.get(), dataTypefaceIndex); 218 return fImpl->createFromStream(stream.detach(), dataTypefaceIndex);
219 } 219 }
220 } 220 }
221 221
222 // No data match, request data and add entry. 222 // No data match, request data and add entry.
223 SkAutoTUnref<SkStreamAsset> stream(fProxy->getData(id.fDataId)); 223 SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId));
224 if (stream.get() == NULL) { 224 if (stream.get() == NULL) {
225 return NULL; 225 return NULL;
226 } 226 }
227 227
228 SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream, id.fTtcInd ex)); 228 SkAutoTUnref<SkTypeface> typeface(fImpl->createFromStream(stream.detach(), i d.fTtcIndex));
229 if (typeface.get() == NULL) { 229 if (typeface.get() == NULL) {
230 return NULL; 230 return NULL;
231 } 231 }
232 232
233 DataEntry& newEntry = fDataCache.push_back(); 233 DataEntry& newEntry = fDataCache.push_back();
234 typeface->weak_ref(); 234 typeface->weak_ref();
235 newEntry.fDataId = id.fDataId; 235 newEntry.fDataId = id.fDataId;
236 newEntry.fTtcIndex = id.fTtcIndex; 236 newEntry.fTtcIndex = id.fTtcIndex;
237 newEntry.fTypeface = typeface.get(); // weak reference passed to new entry. 237 newEntry.fTypeface = typeface.get(); // weak reference passed to new entry.
238 238
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 face.reset(this->matchFamilyStyle(NULL, style)); 290 face.reset(this->matchFamilyStyle(NULL, style));
291 } 291 }
292 292
293 if (NULL == face.get()) { 293 if (NULL == face.get()) {
294 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style); 294 SkFontIdentity fontId = this->fProxy->matchIndexStyle(0, style);
295 face.reset(this->createTypefaceFromFontId(fontId)); 295 face.reset(this->createTypefaceFromFontId(fontId));
296 } 296 }
297 297
298 return face.detach(); 298 return face.detach();
299 } 299 }
OLDNEW
« no previous file with comments | « src/fonts/SkFontMgr_fontconfig.cpp ('k') | src/gpu/gl/GrGLPathRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698