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

Unified Diff: Source/core/fileapi/FileReaderLoader.cpp

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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 | « Source/core/fileapi/FileReaderLoader.h ('k') | Source/core/fileapi/FileReaderSync.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/FileReaderLoader.cpp
diff --git a/Source/core/fileapi/FileReaderLoader.cpp b/Source/core/fileapi/FileReaderLoader.cpp
index 030b24c62b7ab48d8471724031f5bb2702c03215..d18e095033f1aea02d6b78cdf1fa5b9a40b5297a 100644
--- a/Source/core/fileapi/FileReaderLoader.cpp
+++ b/Source/core/fileapi/FileReaderLoader.cpp
@@ -80,11 +80,12 @@ FileReaderLoader::~FileReaderLoader()
if (m_urlForReadingIsStream)
BlobRegistry::unregisterStreamURL(m_urlForReading);
else
- BlobRegistry::unregisterBlobURL(m_urlForReading);
+ BlobRegistry::revokePublicBlobURL(m_urlForReading);
}
}
-void FileReaderLoader::startForURL(ExecutionContext* executionContext, const KURL& url)
+
+void FileReaderLoader::startInternal(ExecutionContext* executionContext, const Stream* stream, PassRefPtr<BlobDataHandle> blobData)
{
// The blob is read by routing through the request handling layer given a temporary public url.
m_urlForReading = BlobURL::createPublicURL(executionContext->securityOrigin());
@@ -93,10 +94,13 @@ void FileReaderLoader::startForURL(ExecutionContext* executionContext, const KUR
return;
}
- if (m_urlForReadingIsStream)
- BlobRegistry::registerStreamURL(executionContext->securityOrigin(), m_urlForReading, url);
- else
- BlobRegistry::registerBlobURL(executionContext->securityOrigin(), m_urlForReading, url);
+ if (blobData) {
+ ASSERT(!stream);
+ BlobRegistry::registerPublicBlobURL(executionContext->securityOrigin(), m_urlForReading, blobData);
+ } else {
+ ASSERT(stream);
+ BlobRegistry::registerStreamURL(executionContext->securityOrigin(), m_urlForReading, stream->url());
+ }
// Construct and load the request.
ResourceRequest request(m_urlForReading);
@@ -121,10 +125,10 @@ void FileReaderLoader::startForURL(ExecutionContext* executionContext, const KUR
ThreadableLoader::loadResourceSynchronously(executionContext, request, *this, options);
}
-void FileReaderLoader::start(ExecutionContext* executionContext, const Blob& blob)
+void FileReaderLoader::start(ExecutionContext* executionContext, PassRefPtr<BlobDataHandle> blobData)
{
m_urlForReadingIsStream = false;
- startForURL(executionContext, blob.url());
+ startInternal(executionContext, 0, blobData);
}
void FileReaderLoader::start(ExecutionContext* executionContext, const Stream& stream, unsigned readSize)
@@ -136,7 +140,7 @@ void FileReaderLoader::start(ExecutionContext* executionContext, const Stream& s
}
m_urlForReadingIsStream = true;
- startForURL(executionContext, stream.url());
+ startInternal(executionContext, &stream, 0);
}
void FileReaderLoader::cancel()
« no previous file with comments | « Source/core/fileapi/FileReaderLoader.h ('k') | Source/core/fileapi/FileReaderSync.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698