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

Unified Diff: WebCore/Modules/filesystem/DOMFileSystem.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 | « Platform/chromium/public/WebHTTPBody.h ('k') | WebCore/Modules/filesystem/DOMFileSystemSync.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: WebCore/Modules/filesystem/DOMFileSystem.cpp
===================================================================
--- WebCore/Modules/filesystem/DOMFileSystem.cpp (revision 140218)
+++ WebCore/Modules/filesystem/DOMFileSystem.cpp (working copy)
@@ -148,14 +148,14 @@
namespace {
-class GetMetadataCallback : public FileSystemCallbacksBase {
+class SnapshotFileCallback : public FileSystemCallbacksBase {
public:
- static PassOwnPtr<GetMetadataCallback> create(PassRefPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+ static PassOwnPtr<SnapshotFileCallback> create(PassRefPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- return adoptPtr(new GetMetadataCallback(filesystem, name, url, successCallback, errorCallback));
+ return adoptPtr(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback));
}
- virtual void didReadMetadata(const FileMetadata& metadata)
+ virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<BlobDataHandle> snapshot)
{
ASSERT(!metadata.platformPath.isEmpty());
if (!m_successCallback)
@@ -176,10 +176,16 @@
}
m_successCallback.release();
+
+ // We can't directly use the snapshot blob data handle because the content type on it hasn't been set.
+ // Having a chain of custody thru thread bridging of that instance up until now, *after* we've coined a File with a new handle
+ // that has the correct type set on it, allows the blob storage system to track when a temp file can and can't
+ // be safely deleted.
+ // FIXME: Maybe add a BlobDataHandle/BlobRegistry methods to clone a blob with a new type?
}
private:
- GetMetadataCallback(PassRefPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+ SnapshotFileCallback(PassRefPtr<DOMFileSystem> filesystem, const String& name, const KURL& url, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
: FileSystemCallbacksBase(errorCallback)
, m_filesystem(filesystem)
, m_name(name)
@@ -199,7 +205,7 @@
void DOMFileSystem::createFile(const FileEntry* fileEntry, PassRefPtr<FileCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
KURL fileSystemURL = createFileSystemURL(fileEntry);
- m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileSystemURL, GetMetadataCallback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCallback));
+ m_asyncFileSystem->createSnapshotFileAndReadMetadata(fileSystemURL, SnapshotFileCallback::create(this, fileEntry->name(), fileSystemURL, successCallback, errorCallback));
}
} // namespace WebCore
« no previous file with comments | « Platform/chromium/public/WebHTTPBody.h ('k') | WebCore/Modules/filesystem/DOMFileSystemSync.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698