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

Side by Side Diff: dm/DMWriteTask.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Treat SkFontMgr::createFromStream as taking ownership of the stream (is this correct?) 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
OLDNEW
1 #include "DMWriteTask.h" 1 #include "DMWriteTask.h"
2 2
3 #include "DMJsonWriter.h" 3 #include "DMJsonWriter.h"
4 #include "DMUtil.h" 4 #include "DMUtil.h"
5 #include "SkColorPriv.h" 5 #include "SkColorPriv.h"
6 #include "SkCommonFlags.h" 6 #include "SkCommonFlags.h"
7 #include "SkData.h" 7 #include "SkData.h"
8 #include "SkImageEncoder.h" 8 #include "SkImageEncoder.h"
9 #include "SkMD5.h" 9 #include "SkMD5.h"
10 #include "SkMallocPixelRef.h" 10 #include "SkMallocPixelRef.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 WriteTask::WriteTask(const Task& parent, 49 WriteTask::WriteTask(const Task& parent,
50 const char* sourceType, 50 const char* sourceType,
51 SkStreamAsset *data, 51 SkStreamAsset *data,
52 const char* ext) 52 const char* ext)
53 : CpuTask(parent) 53 : CpuTask(parent)
54 , fBaseName(find_base_name(parent, &fSuffixes)) 54 , fBaseName(find_base_name(parent, &fSuffixes))
55 , fSourceType(sourceType) 55 , fSourceType(sourceType)
56 , fData(data) 56 , fData(data)
57 , fExtension(ext) { 57 , fExtension(ext) {
58 SkASSERT(fData.get()); 58 SkASSERT(fData.get());
59 SkASSERT(fData->unique());
60 } 59 }
61 60
62 void WriteTask::makeDirOrFail(SkString dir) { 61 void WriteTask::makeDirOrFail(SkString dir) {
63 // This can be a little racy, so if it fails check to see if someone else su cceeded. 62 // This can be a little racy, so if it fails check to see if someone else su cceeded.
64 if (!sk_mkdir(dir.c_str()) && !sk_isdir(dir.c_str())) { 63 if (!sk_mkdir(dir.c_str()) && !sk_isdir(dir.c_str())) {
65 this->fail("Can't make directory."); 64 this->fail("Can't make directory.");
66 } 65 }
67 } 66 }
68 67
69 static SkString get_md5_string(SkMD5* hasher) { 68 static SkString get_md5_string(SkMD5* hasher) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 179 }
181 name.append(fBaseName.c_str()); 180 name.append(fBaseName.c_str());
182 return name; 181 return name;
183 } 182 }
184 183
185 bool WriteTask::shouldSkip() const { 184 bool WriteTask::shouldSkip() const {
186 return FLAGS_writePath.isEmpty(); 185 return FLAGS_writePath.isEmpty();
187 } 186 }
188 187
189 } // namespace DM 188 } // namespace DM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698