Index: WebCore/fileapi/Blob.cpp |
=================================================================== |
--- WebCore/fileapi/Blob.cpp (revision 140218) |
+++ WebCore/fileapi/Blob.cpp (working copy) |
@@ -40,50 +40,14 @@ |
namespace WebCore { |
-namespace { |
- |
-// Used in histograms to see when we can actually deprecate the prefixed slice. |
-enum SliceHistogramEnum { |
- SliceWithoutPrefix, |
- SliceWithPrefix, |
- SliceHistogramEnumMax, |
-}; |
- |
-} // namespace |
- |
-Blob::Blob() |
- : m_size(0) |
+Blob::Blob(PassRefPtr<BlobDataHandle> dataHandle) |
+ : m_blobDataHandle(dataHandle) |
{ |
- OwnPtr<BlobData> blobData = BlobData::create(); |
- |
- // Create a new internal URL and register it with the provided blob data. |
- m_internalURL = BlobURL::createInternalURL(); |
- ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData.release()); |
+ ASSERT(m_blobDataHandle); |
} |
-Blob::Blob(PassOwnPtr<BlobData> blobData, long long size) |
- : m_type(blobData->contentType()) |
- , m_size(size) |
-{ |
- ASSERT(blobData); |
- |
- // Create a new internal URL and register it with the provided blob data. |
- m_internalURL = BlobURL::createInternalURL(); |
- ThreadableBlobRegistry::registerBlobURL(m_internalURL, blobData); |
-} |
- |
-Blob::Blob(const KURL& srcURL, const String& type, long long size) |
- : m_type(type) |
- , m_size(size) |
-{ |
- // Create a new internal URL and register it with the same blob data as the source URL. |
- m_internalURL = BlobURL::createInternalURL(); |
- ThreadableBlobRegistry::registerBlobURL(0, m_internalURL, srcURL); |
-} |
- |
Blob::~Blob() |
{ |
- ThreadableBlobRegistry::unregisterBlobURL(m_internalURL); |
} |
#if ENABLE(BLOB) |
@@ -97,8 +61,8 @@ |
// FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous. |
toFile(this)->captureSnapshot(size, modificationTime); |
} else { |
- ASSERT(m_size != -1); |
- size = m_size; |
+ size = this->size(); |
+ ASSERT(size != -1); |
} |
// Convert the negative value that is used to select from the end. |
@@ -126,14 +90,14 @@ |
if (isFile()) { |
#if ENABLE(FILE_SYSTEM) |
if (!toFile(this)->fileSystemURL().isEmpty()) |
- blobData->appendURL(toFile(this)->fileSystemURL(), start, length, modificationTime); |
+ blobData->appendFileSystemURL(toFile(this)->fileSystemURL(), start, length, modificationTime); |
else |
#endif |
blobData->appendFile(toFile(this)->path(), start, length, modificationTime); |
} else |
- blobData->appendBlob(m_internalURL, start, length); |
+ blobData->appendBlob(m_blobDataHandle, start, length); |
- return Blob::create(blobData.release(), length); |
+ return Blob::create(BlobDataHandle::create(blobData.release(), length)); |
} |
#endif |