Chromium Code Reviews| Index: Source/core/fileapi/BlobBuilder.cpp |
| diff --git a/Source/core/fileapi/BlobBuilder.cpp b/Source/core/fileapi/BlobBuilder.cpp |
| index 8be60c17f457fc44cbcd3860d14bce7dd0ed2539..a311bd8780b90e159c64a6370341ff2edcde1be3 100644 |
| --- a/Source/core/fileapi/BlobBuilder.cpp |
| +++ b/Source/core/fileapi/BlobBuilder.cpp |
| @@ -94,7 +94,7 @@ void BlobBuilder::append(Blob* blob) |
| { |
| if (!blob) |
| return; |
| - if (blob->isFile()) { |
| + if (blob->isOnFilesystem()) { |
| File* file = toFile(blob); |
| // If the blob is file that is not snapshoted, capture the snapshot now. |
| // FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous. |
| @@ -134,7 +134,22 @@ PassRefPtr<Blob> BlobBuilder::getBlob(const String& contentType) |
| // Instead, we only need to keep a reference to the blob data just created. |
| m_items.append(BlobDataItem(blob->blobDataHandle(), 0, m_size)); |
| - return blob; |
| + return blob.release(); |
| +} |
| + |
| +PassRefPtr<File> BlobBuilder::getFile(const String& contentType, const String& fileName, double modificationTime) |
|
esprehn
2013/11/04 19:28:08
createFile, method that create objects shouldn't b
pwnall-personal
2013/11/04 23:01:21
Actually, I think this whole class should be moved
|
| +{ |
| + OwnPtr<BlobData> blobData = BlobData::create(); |
| + blobData->setContentType(contentType); |
| + blobData->swapItems(m_items); |
| + |
| + RefPtr<File> file = File::create(fileName, modificationTime, BlobDataHandle::create(blobData.release(), m_size)); |
| + |
| + // After creating a file from the current blob data, we do not need to keep the data around any more. |
| + // Instead, we only need to keep a reference to the blob data just created. |
| + m_items.append(BlobDataItem(file->blobDataHandle(), 0, m_size)); |
|
esprehn
2013/11/04 19:28:08
What cleans this up to prevent leaks?
pwnall-personal
2013/11/04 23:01:21
I borrowed this code from "getBlob", so I don't kn
|
| + |
| + return file.release(); |
| } |
| } // namespace WebCore |