OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |