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

Side by Side Diff: Source/platform/fonts/skia/FontCustomPlatformDataSkia.cpp

Issue 860383006: Stop using SkAutoTUnref on SkStream. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp ('k') | no next file » | 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 (C) 2007 Apple Computer, Inc. 2 * Copyright (C) 2007 Apple Computer, Inc.
3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved. 3 * Copyright (c) 2007, 2008, 2009, Google Inc. All rights reserved.
4 * Copyright (C) 2010 Company 100, Inc. 4 * Copyright (C) 2010 Company 100, Inc.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer) 90 PassOwnPtr<FontCustomPlatformData> FontCustomPlatformData::create(SharedBuffer* buffer)
91 { 91 {
92 ASSERT_ARG(buffer, buffer); 92 ASSERT_ARG(buffer, buffer);
93 93
94 OpenTypeSanitizer sanitizer(buffer); 94 OpenTypeSanitizer sanitizer(buffer);
95 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize(); 95 RefPtr<SharedBuffer> transcodeBuffer = sanitizer.sanitize();
96 if (!transcodeBuffer) 96 if (!transcodeBuffer)
97 return nullptr; // validation failed. 97 return nullptr; // validation failed.
98 buffer = transcodeBuffer.get(); 98 buffer = transcodeBuffer.get();
99 99
100 SkAutoTUnref<SkMemoryStream> stream(new SkMemoryStream(buffer->getAsSkData() .get())); 100 SkMemoryStream* stream = new SkMemoryStream(buffer->getAsSkData().get());
101 #if OS(WIN) 101 #if OS(WIN)
102 RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager() ->createFromStream(stream.get())); 102 RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager() ->createFromStream(stream));
103 #else 103 #else
104 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream.g et())); 104 RefPtr<SkTypeface> typeface = adoptRef(SkTypeface::CreateFromStream(stream)) ;
105 #endif 105 #endif
106 if (!typeface) 106 if (!typeface)
107 return nullptr; 107 return nullptr;
108 108
109 return adoptPtr(new FontCustomPlatformData(typeface.release())); 109 return adoptPtr(new FontCustomPlatformData(typeface.release()));
110 } 110 }
111 111
112 bool FontCustomPlatformData::supportsFormat(const String& format) 112 bool FontCustomPlatformData::supportsFormat(const String& format)
113 { 113 {
114 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o pentype") || OpenTypeSanitizer::supportsFormat(format); 114 return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "o pentype") || OpenTypeSanitizer::supportsFormat(format);
115 } 115 }
116 116
117 } // namespace blink 117 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/mac/FontCustomPlatformDataMac.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698