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

Unified Diff: third_party/WebKit/Source/core/fileapi/Blob.cpp

Issue 1609313002: Use BlobCallback in toBlob instead of FileCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase master and Renamed mimeType to contentType to match other bits in Blob.h Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/fileapi/Blob.cpp
diff --git a/third_party/WebKit/Source/core/fileapi/Blob.cpp b/third_party/WebKit/Source/core/fileapi/Blob.cpp
index adcbe8bbd06c90470673bc09b69ef8b66f5b6e23..d744a0057c355bb3639b447990eb77283a54b299 100644
--- a/third_party/WebKit/Source/core/fileapi/Blob.cpp
+++ b/third_party/WebKit/Source/core/fileapi/Blob.cpp
@@ -105,6 +105,18 @@ Blob* Blob::create(const HeapVector<ArrayBufferOrArrayBufferViewOrBlobOrString>&
return new Blob(BlobDataHandle::create(blobData.release(), blobSize));
}
+Blob* Blob::create(const unsigned char* data, size_t bytes, const String& contentType)
+{
+ ASSERT(data);
+
+ OwnPtr<BlobData> blobData = BlobData::create();
+ blobData->setContentType(contentType);
+ blobData->appendBytes(data, bytes);
+ long long blobSize = blobData->length();
+
+ return new Blob(BlobDataHandle::create(blobData.release(), blobSize));
+}
+
void Blob::clampSliceOffsets(long long size, long long& start, long long& end)
{
ASSERT(size != -1);
« no previous file with comments | « third_party/WebKit/Source/core/fileapi/Blob.h ('k') | third_party/WebKit/Source/core/fileapi/BlobCallback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698