RESOLVED FIXED 44732
Add DOMFileSystem implementation to support Entry manipulation operations
https://bugs.webkit.org/show_bug.cgi?id=44732
Summary Add DOMFileSystem implementation to support Entry manipulation operations
Kinuko Yasuda
Reported 2010-08-26 16:56:48 PDT
DOMFileSystem, Entry and DirectoryEntry need implementation to support file system operations (move, copy, etc).
Attachments
Patch (20.94 KB, patch)
2010-08-26 17:56 PDT, Kinuko Yasuda
no flags
Patch (26.42 KB, patch)
2010-08-27 17:50 PDT, Kinuko Yasuda
no flags
Patch (40.96 KB, patch)
2010-08-28 21:29 PDT, Kinuko Yasuda
no flags
Patch (30.09 KB, patch)
2010-08-30 12:21 PDT, Kinuko Yasuda
no flags
Patch (30.14 KB, patch)
2010-08-30 12:33 PDT, Kinuko Yasuda
fishd: review+
fishd: commit-queue-
Kinuko Yasuda
Comment 1 2010-08-26 17:56:13 PDT
Created attachment 65653 [details] Patch This patch depends on unsubmitted AsyncFileSystem interface (bug 44433), but I'm uploading this as this includes a lot of spec-oriented details that are independent from other part.
Eric U.
Comment 2 2010-08-26 18:19:33 PDT
Comment on attachment 65653 [details] Patch WebCore/storage/DOMFileSystem.cpp:102 + if (newName.isEmpty() && DOMFilePath::getDirectory(src->fullPath()) == parent->fullPath()) You also need to verify that newName is different than the existing name. WebCore/storage/DirectoryEntry.h:57 + void getFile(const String& fullPath, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); You've got fullPath here and path in some of the other files [e.g. DirectoryEntry.cpp]. If you want to emphasize that these are full paths, let's do it everywhere.
Darin Fisher (:fishd, Google)
Comment 3 2010-08-27 14:40:16 PDT
Comment on attachment 65653 [details] Patch WebCore/storage/DOMFileSystem.cpp:157 + errorCallback->handleEvent(FileError::create(INVALID_MODIFICATION_ERR).get()); should this be dispatched asynchronously? it seems like all events should be dispatched asynchronously for consistency. plus nesting JS -> C++ -> JS can sometimes be problematic. otherwise LGTM
Kinuko Yasuda
Comment 4 2010-08-27 17:50:57 PDT
Kinuko Yasuda
Comment 5 2010-08-27 17:55:31 PDT
(In reply to comment #2) > (From update of attachment 65653 [details]) > WebCore/storage/DOMFileSystem.cpp:102 > + if (newName.isEmpty() && DOMFilePath::getDirectory(src->fullPath()) == parent->fullPath()) > You also need to verify that newName is different than the existing name. Fixed. > WebCore/storage/DirectoryEntry.h:57 > + void getFile(const String& fullPath, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); > You've got fullPath here and path in some of the other files [e.g. DirectoryEntry.cpp]. If you want to emphasize that these are full paths, let's do it everywhere. getFile and getDirectory can take either absolute path or relative path, so they must be |path|... fixed. (In reply to comment #3) > (From update of attachment 65653 [details]) > WebCore/storage/DOMFileSystem.cpp:157 > + errorCallback->handleEvent(FileError::create(INVALID_MODIFICATION_ERR).get()); > should this be dispatched asynchronously? it seems like all events should be > dispatched asynchronously for consistency. plus nesting JS -> C++ -> JS can > sometimes be problematic. Changed to post a task that dispatches an error callback.
Kinuko Yasuda
Comment 6 2010-08-28 21:29:42 PDT
Created attachment 65845 [details] Patch Did more cleanups for firing callbacks asynchronously
Darin Fisher (:fishd, Google)
Comment 7 2010-08-29 14:40:40 PDT
Comment on attachment 65845 [details] Patch > WebCore/platform/AsyncFileSystemCallbacks.h:46 > + virtual void didSucceed(bool fireImmediate = true) = 0; i guess the fireImmediate parameter exists because these callbacks can sometimes be run synchronously from the AsyncFileSystem methods? maybe that should not be the case? it'd be nice if this layer promised not to callback synchronously. > :184 > + m_asyncFileSystem->createDirectory(absolutePath, flags->isExclusive(), new EntryCallbacks(successCallback, errorCallback, scriptExecutionContext(), this, absolutePath, true)); since you need to allocate EntryCallbacks with exactly the same arguments in both cases here, how about allocating them once above the if statement? EntryCallbacks* callbacks = new EntryCallbacks(...); if (flags && flags->isCreate()) m_asyncFileSystem->createDirectory(..., callbacks); else m_asyncFileSystem->directoryExists(..., callbacks); That should improve readability a bit. It'd also be nice to do this anywhere else that it is applicable. > :83 > + class DispatchCallbackTask : public ScriptExecutionContext::Task { some of this machinery for callbacks seems like it is not specific to DOMFileSystem. is it the case that we don't have code like this elsewhere in webcore? maybe it is a FIXME to break this out into a generic place? i haven't had a chance to fully review this patch. this is just some early feedback.
Kinuko Yasuda
Comment 8 2010-08-30 12:21:19 PDT
Created attachment 65938 [details] Patch This change depends on the the other change for bug 44732
Kinuko Yasuda
Comment 9 2010-08-30 12:22:12 PDT
(In reply to comment #8) > This change depends on the the other change for bug 44732 Please ignore this comment.
Kinuko Yasuda
Comment 10 2010-08-30 12:33:17 PDT
Darin Fisher (:fishd, Google)
Comment 11 2010-08-30 12:56:49 PDT
Comment on attachment 65939 [details] Patch glad to see that fireImmediates was not necessary afterall. > :82 > + // FIXME: move this to a more generic place. nit: can this class be made private? > :70 > + // FIXME: clean up this. please make this FIXME comment more descriptive. it is unclear what you want to clean up.
Kinuko Yasuda
Comment 12 2010-08-30 13:50:40 PDT
Note You need to log in before you can comment on or make changes to this bug.