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

Unified Diff: Source/modules/filesystem/DOMFileSystem.cpp

Issue 388923004: FileSystem: Move SnapshotFileCallback into FileSystemCallbacks.h (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | « no previous file | Source/modules/filesystem/FileSystemCallbacks.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/filesystem/DOMFileSystem.cpp
diff --git a/Source/modules/filesystem/DOMFileSystem.cpp b/Source/modules/filesystem/DOMFileSystem.cpp
index 66ad0108025719ff9b6afd18170231b9baad3dc0..e8b4aae0c0b9863a8fca156b166faad42b1fe448 100644
--- a/Source/modules/filesystem/DOMFileSystem.cpp
+++ b/Source/modules/filesystem/DOMFileSystem.cpp
@@ -31,7 +31,6 @@
#include "config.h"
#include "modules/filesystem/DOMFileSystem.h"
-#include "core/fileapi/File.h"
#include "modules/filesystem/DOMFilePath.h"
#include "modules/filesystem/DirectoryEntry.h"
#include "modules/filesystem/ErrorCallback.h"
@@ -153,58 +152,6 @@ void DOMFileSystem::createWriter(const FileEntry* fileEntry, PassOwnPtr<FileWrit
fileSystem()->createFileWriter(createFileSystemURL(fileEntry), fileWriter, callbacks.release());
}
-namespace {
-
-class SnapshotFileCallback : public FileSystemCallbacksBase {
-public:
- static PassOwnPtr<AsyncFileSystemCallbacks> create(DOMFileSystem* filesystem, const String& name, const KURL& url, PassOwnPtr<FileCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback, ExecutionContext* context)
- {
- return adoptPtr(static_cast<AsyncFileSystemCallbacks*>(new SnapshotFileCallback(filesystem, name, url, successCallback, errorCallback, context)));
- }
-
- virtual void didCreateSnapshotFile(const FileMetadata& metadata, PassRefPtr<BlobDataHandle> snapshot)
- {
- if (!m_successCallback)
- return;
-
- // We can't directly use the snapshot blob data handle because the content type on it hasn't been set.
- // The |snapshot| param is here to provide a a chain of custody thru thread bridging that is held onto until
- // *after* we've coined a File with a new handle that has the correct type set on it. This allows the
- // blob storage system to track when a temp file can and can't be safely deleted.
-
- // For regular filesystem types (temporary or persistent), we should not cache file metadata as it could change File semantics.
- // For other filesystem types (which could be platform-specific ones), there's a chance that the files are on remote filesystem. If the port has returned metadata just pass it to File constructor (so we may cache the metadata).
- // FIXME: We should use the snapshot metadata for all files.
- // https://www.w3.org/Bugs/Public/show_bug.cgi?id=17746
- if (m_fileSystem->type() == FileSystemTypeTemporary || m_fileSystem->type() == FileSystemTypePersistent) {
- m_successCallback->handleEvent(File::createWithName(metadata.platformPath, m_name).get());
- } else if (!metadata.platformPath.isEmpty()) {
- // If the platformPath in the returned metadata is given, we create a File object for the path.
- m_successCallback->handleEvent(File::createForFileSystemFile(m_name, metadata).get());
- } else {
- // Otherwise create a File from the FileSystem URL.
- m_successCallback->handleEvent(File::createForFileSystemFile(m_url, metadata).get());
- }
-
- m_successCallback.release();
- }
-
-private:
- SnapshotFileCallback(DOMFileSystem* filesystem, const String& name, const KURL& url, PassOwnPtr<FileCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback, ExecutionContext* context)
- : FileSystemCallbacksBase(errorCallback, filesystem, context)
- , m_name(name)
- , m_url(url)
- , m_successCallback(successCallback)
- {
- }
-
- String m_name;
- KURL m_url;
- OwnPtr<FileCallback> m_successCallback;
-};
-
-} // namespace
-
void DOMFileSystem::createFile(const FileEntry* fileEntry, PassOwnPtr<FileCallback> successCallback, PassOwnPtr<ErrorCallback> errorCallback)
{
KURL fileSystemURL = createFileSystemURL(fileEntry);
« no previous file with comments | « no previous file | Source/modules/filesystem/FileSystemCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698