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

Unified Diff: WebCore/fileapi/Blob.cpp

Issue 11192017: ********** WebCore blob hacking (Closed) Base URL: http://svn.webkit.org/repository/webkit/trunk/Source/
Patch Set: Created 7 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
« no previous file with comments | « WebCore/fileapi/Blob.h ('k') | WebCore/fileapi/BlobURL.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « WebCore/fileapi/Blob.h ('k') | WebCore/fileapi/BlobURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698