[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
kinuko at chromium.org
kinuko at chromium.org
Wed Dec 22 12:48:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 709beb147c80e26035f4dab9634760f1020126ec
Author: kinuko at chromium.org <kinuko at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Aug 30 20:50:19 2010 +0000
2010-08-30 Kinuko Yasuda <kinuko at chromium.osrc>
Reviewed by Darin Fisher.
Add DOMFileSystem implementation to support Entry manipulation operations
https://bugs.webkit.org/show_bug.cgi?id=44732
Fixed virtual-path / platform-path conversion timing. (The conversion needs to be done before calling AsyncFileSystem methods to support cross-filesystem operations.)
* src/AsyncFileSystemChromium.cpp:
(WebCore::AsyncFileSystemChromium::move):
(WebCore::AsyncFileSystemChromium::copy):
(WebCore::AsyncFileSystemChromium::remove):
(WebCore::AsyncFileSystemChromium::readMetadata):
(WebCore::AsyncFileSystemChromium::createFile):
(WebCore::AsyncFileSystemChromium::createDirectory):
(WebCore::AsyncFileSystemChromium::fileExists):
(WebCore::AsyncFileSystemChromium::directoryExists):
(WebCore::AsyncFileSystemChromium::readDirectory):
2010-08-30 Kinuko Yasuda <kinuko at chromium.org>
Reviewed by Darin Fisher.
Add DOMFileSystem implementation to support Entry manipulation operations
https://bugs.webkit.org/show_bug.cgi?id=44732
No new tests; tests will be added later.
* storage/DOMFileSystem.cpp:
(WebCore::DOMFileSystem::root):
(WebCore::checkValidityForForCopyOrMove): Added.
(WebCore::DOMFileSystem::getMetadata): Added.
(WebCore::DOMFileSystem::move): Added.
(WebCore::DOMFileSystem::copy): Added.
(WebCore::DOMFileSystem::remove): Added.
(WebCore::DOMFileSystem::getParent): Added.
(WebCore::DOMFileSystem::getFile): Added.
(WebCore::DOMFileSystem::getDirectory): Added.
(WebCore::DOMFileSystem::readDirectory): Added.
* storage/DirectoryEntry.cpp:
(WebCore::DirectoryEntry::getFile): Added implementation.
(WebCore::DirectoryEntry::getDirectory): Added implementation.
* storage/DirectoryReader.cpp:
(WebCore::DirectoryReader::DirectoryReader): Added implementation.
(WebCore::DirectoryReader::readEntries): Added implementation.
* storage/DirectoryReader.h:
* storage/Entry.cpp:
(WebCore::Entry::getMetadata): Added implementation.
(WebCore::Entry::moveTo): Added implementation.
(WebCore::Entry::copyTo): Added implementation.
(WebCore::Entry::remove): Added implementation.
(WebCore::Entry::getParent): Added implementation.
* storage/Entry.h:
* storage/FileEntry.h:
Added a helper template to schedule callbacks.
* storage/DOMFileSystem.h:
(WebCore::DOMFileSystem::DispatchCallbackTask): Added to schedule callbacks.
(WebCore::DOMFileSystem::scheduleCallback): Added to schedule callbacks.
Changed to fire callbacks asynchronously.
* storage/LocalFileSystem.cpp:
(WebCore::LocalFileSystem::requestFileSystem):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66407 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index bfc0bcb..5391367 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,48 @@
+2010-08-30 Kinuko Yasuda <kinuko at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ Add DOMFileSystem implementation to support Entry manipulation operations
+ https://bugs.webkit.org/show_bug.cgi?id=44732
+
+ No new tests; tests will be added later.
+
+ * storage/DOMFileSystem.cpp:
+ (WebCore::DOMFileSystem::root):
+ (WebCore::checkValidityForForCopyOrMove): Added.
+ (WebCore::DOMFileSystem::getMetadata): Added.
+ (WebCore::DOMFileSystem::move): Added.
+ (WebCore::DOMFileSystem::copy): Added.
+ (WebCore::DOMFileSystem::remove): Added.
+ (WebCore::DOMFileSystem::getParent): Added.
+ (WebCore::DOMFileSystem::getFile): Added.
+ (WebCore::DOMFileSystem::getDirectory): Added.
+ (WebCore::DOMFileSystem::readDirectory): Added.
+ * storage/DirectoryEntry.cpp:
+ (WebCore::DirectoryEntry::getFile): Added implementation.
+ (WebCore::DirectoryEntry::getDirectory): Added implementation.
+ * storage/DirectoryReader.cpp:
+ (WebCore::DirectoryReader::DirectoryReader): Added implementation.
+ (WebCore::DirectoryReader::readEntries): Added implementation.
+ * storage/DirectoryReader.h:
+ * storage/Entry.cpp:
+ (WebCore::Entry::getMetadata): Added implementation.
+ (WebCore::Entry::moveTo): Added implementation.
+ (WebCore::Entry::copyTo): Added implementation.
+ (WebCore::Entry::remove): Added implementation.
+ (WebCore::Entry::getParent): Added implementation.
+ * storage/Entry.h:
+ * storage/FileEntry.h:
+
+ Added a helper template to schedule callbacks.
+ * storage/DOMFileSystem.h:
+ (WebCore::DOMFileSystem::DispatchCallbackTask): Added to schedule callbacks.
+ (WebCore::DOMFileSystem::scheduleCallback): Added to schedule callbacks.
+
+ Changed to fire callbacks asynchronously.
+ * storage/LocalFileSystem.cpp:
+ (WebCore::LocalFileSystem::requestFileSystem):
+
2010-08-30 Alejandro G. Castro <alex at igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/platform/AsyncFileSystem.h b/WebCore/platform/AsyncFileSystem.h
index 82f7163..601f0ea 100644
--- a/WebCore/platform/AsyncFileSystem.h
+++ b/WebCore/platform/AsyncFileSystem.h
@@ -34,6 +34,7 @@
#if ENABLE(FILE_SYSTEM)
#include "PlatformString.h"
+#include "Timer.h"
#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -41,7 +42,7 @@ namespace WebCore {
class AsyncFileSystem;
class AsyncFileSystemCallbacks;
-// This class provides async interface for platform-specific DOMFileSystem implementation. Note that all the methods take canonicalized virtual paths.
+// This class provides async interface for platform-specific file system implementation. Note that all the methods take platform paths.
class AsyncFileSystem : public Noncopyable {
public:
virtual ~AsyncFileSystem() { }
diff --git a/WebCore/storage/DOMFileSystem.cpp b/WebCore/storage/DOMFileSystem.cpp
index 5d6073a..f1b9342 100644
--- a/WebCore/storage/DOMFileSystem.cpp
+++ b/WebCore/storage/DOMFileSystem.cpp
@@ -34,8 +34,18 @@
#if ENABLE(FILE_SYSTEM)
#include "AsyncFileSystem.h"
+#include "DOMFilePath.h"
#include "DirectoryEntry.h"
+#include "EntriesCallback.h"
+#include "Entry.h"
+#include "EntryCallback.h"
+#include "ErrorCallback.h"
+#include "FileError.h"
+#include "FileSystemCallbacks.h"
+#include "MetadataCallback.h"
#include "ScriptExecutionContext.h"
+#include "VoidCallback.h"
+#include <wtf/OwnPtr.h>
namespace WebCore {
@@ -52,7 +62,7 @@ DOMFileSystem::~DOMFileSystem()
PassRefPtr<DirectoryEntry> DOMFileSystem::root()
{
- return DirectoryEntry::create(this, "/");
+ return DirectoryEntry::create(this, DOMFilePath::root);
}
void DOMFileSystem::stop()
@@ -70,6 +80,131 @@ void DOMFileSystem::contextDestroyed()
m_asyncFileSystem->stop();
}
+void DOMFileSystem::getMetadata(const Entry* entry, PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(entry->fullPath());
+ m_asyncFileSystem->readMetadata(platformPath, new MetadataCallbacks(successCallback, errorCallback));
+}
+
+static bool checkValidityForForCopyOrMove(const Entry* src, Entry* parent, const String& newName)
+{
+ ASSERT(src);
+
+ if (!parent || !parent->isDirectory())
+ return false;
+
+ if (!newName.isEmpty() && !DOMFilePath::isValidName(newName))
+ return false;
+
+ // It is an error to try to copy or move an entry inside itself at any depth if it is a directory.
+ if (src->isDirectory() && DOMFilePath::isParentOf(src->fullPath(), parent->fullPath()))
+ return false;
+
+ // It is an error to copy or move an entry into its parent if a name different from its current one isn't provided.
+ if ((newName.isEmpty() || src->name() == newName) && DOMFilePath::getDirectory(src->fullPath()) == parent->fullPath())
+ return false;
+
+ return true;
+}
+
+void DOMFileSystem::move(const Entry* src, PassRefPtr<Entry> parent, const String& newName, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ if (!checkValidityForForCopyOrMove(src, parent.get(), newName)) {
+ scheduleCallback(scriptExecutionContext(), errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
+ return;
+ }
+
+ String destPath = parent->fullPath();
+ if (!newName.isEmpty())
+ destPath = DOMFilePath::append(destPath, newName);
+ else
+ destPath = DOMFilePath::append(destPath, src->name());
+
+ String srcPlatformPath = m_asyncFileSystem->virtualToPlatformPath(src->fullPath());
+ String destPlatformPath = parent->filesystem()->asyncFileSystem()->virtualToPlatformPath(destPath);
+ m_asyncFileSystem->move(srcPlatformPath, destPlatformPath, new EntryCallbacks(successCallback, errorCallback, this, destPath, src->isDirectory()));
+}
+
+void DOMFileSystem::copy(const Entry* src, PassRefPtr<Entry> parent, const String& newName, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ if (!checkValidityForForCopyOrMove(src, parent.get(), newName)) {
+ scheduleCallback(scriptExecutionContext(), errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
+ return;
+ }
+
+ String destPath = parent->fullPath();
+ if (!newName.isEmpty())
+ destPath = DOMFilePath::append(destPath, newName);
+ else
+ destPath = DOMFilePath::append(destPath, src->name());
+
+ String srcPlatformPath = m_asyncFileSystem->virtualToPlatformPath(src->fullPath());
+ String destPlatformPath = parent->filesystem()->asyncFileSystem()->virtualToPlatformPath(destPath);
+ m_asyncFileSystem->copy(srcPlatformPath, destPlatformPath, new EntryCallbacks(successCallback, errorCallback, this, destPath, src->isDirectory()));
+}
+
+void DOMFileSystem::remove(const Entry* entry, PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ ASSERT(entry);
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(entry->fullPath());
+ m_asyncFileSystem->remove(platformPath, new VoidCallbacks(successCallback, errorCallback));
+}
+
+void DOMFileSystem::getParent(const Entry* entry, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ ASSERT(entry);
+ String path = DOMFilePath::getDirectory(entry->fullPath());
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(path);
+ m_asyncFileSystem->directoryExists(platformPath, new EntryCallbacks(successCallback, errorCallback, this, path, true));
+}
+
+void DOMFileSystem::getFile(const Entry* base, const String& path, PassRefPtr<Flags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ ASSERT(base);
+ if (!DOMFilePath::isValidPath(path)) {
+ scheduleCallback(scriptExecutionContext(), errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
+ return;
+ }
+
+ String absolutePath = path;
+ if (!DOMFilePath::isAbsolute(path))
+ absolutePath = DOMFilePath::removeExtraParentReferences(DOMFilePath::append(base->fullPath(), path));
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(absolutePath);
+
+ OwnPtr<EntryCallbacks> callbacks = adoptPtr(new EntryCallbacks(successCallback, errorCallback, this, absolutePath, false));
+ if (flags && flags->isCreate())
+ m_asyncFileSystem->createFile(platformPath, flags->isExclusive(), callbacks.release());
+ else
+ m_asyncFileSystem->fileExists(platformPath, callbacks.release());
+}
+
+void DOMFileSystem::getDirectory(const Entry* base, const String& path, PassRefPtr<Flags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ ASSERT(base);
+ if (!DOMFilePath::isValidPath(path)) {
+ scheduleCallback(scriptExecutionContext(), errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
+ return;
+ }
+
+ String absolutePath = path;
+ if (!DOMFilePath::isAbsolute(path))
+ absolutePath = DOMFilePath::removeExtraParentReferences(DOMFilePath::append(base->fullPath(), path));
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(absolutePath);
+
+ OwnPtr<EntryCallbacks> callbacks = adoptPtr(new EntryCallbacks(successCallback, errorCallback, this, absolutePath, true));
+ if (flags && flags->isCreate())
+ m_asyncFileSystem->createDirectory(platformPath, flags->isExclusive(), callbacks.release());
+ else
+ m_asyncFileSystem->directoryExists(platformPath, callbacks.release());
+}
+
+void DOMFileSystem::readDirectory(const String& path, PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
+{
+ ASSERT(DOMFilePath::isAbsolute(path));
+ String platformPath = m_asyncFileSystem->virtualToPlatformPath(path);
+ m_asyncFileSystem->readDirectory(platformPath, new EntriesCallbacks(successCallback, errorCallback, this, path));
+}
+
} // namespace
#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/storage/DOMFileSystem.h b/WebCore/storage/DOMFileSystem.h
index 337bea9..f779aba 100644
--- a/WebCore/storage/DOMFileSystem.h
+++ b/WebCore/storage/DOMFileSystem.h
@@ -37,13 +37,19 @@
#include "AsyncFileSystem.h"
#include "Flags.h"
#include "PlatformString.h"
+#include "ScriptExecutionContext.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class DirectoryEntry;
-class ScriptExecutionContext;
+class Entry;
+class EntryCallback;
+class EntriesCallback;
+class ErrorCallback;
+class MetadataCallback;
+class VoidCallback;
class DOMFileSystem : public RefCounted<DOMFileSystem>, public ActiveDOMObject {
public:
@@ -62,13 +68,57 @@ public:
virtual bool hasPendingActivity() const;
virtual void contextDestroyed();
+ // Actual FileSystem API implementations. All the validity checks on virtual paths are done at DOMFileSystem level.
+ void getMetadata(const Entry* entry, PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback);
+ void move(const Entry* src, PassRefPtr<Entry> parent, const String& name, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
+ void copy(const Entry* src, PassRefPtr<Entry> parent, const String& name, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
+ void remove(const Entry* entry, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>);
+ void getParent(const Entry* entry, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
+ void getFile(const Entry* base, const String& path, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
+ void getDirectory(const Entry* base, const String& path, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>);
+ void readDirectory(const String& path, PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>);
+
+ // Schedule a callback. This should not cross threads (should be called on the same context thread).
+ template <typename CB, typename CBArg>
+ static void scheduleCallback(ScriptExecutionContext*, PassRefPtr<CB>, PassRefPtr<CBArg>);
+
private:
DOMFileSystem(ScriptExecutionContext*, const String& name, PassOwnPtr<AsyncFileSystem>);
+ AsyncFileSystem* asyncFileSystem() const { return m_asyncFileSystem.get(); }
+
+ // A helper template to schedule a callback task.
+ // FIXME: move this to a more generic place.
+ template <typename CB, typename CBArg>
+ class DispatchCallbackTask : public ScriptExecutionContext::Task {
+ public:
+ DispatchCallbackTask(PassRefPtr<CB> callback, PassRefPtr<CBArg> arg)
+ : m_callback(callback)
+ , m_callbackArg(arg)
+ {
+ }
+
+ virtual void performTask(ScriptExecutionContext*)
+ {
+ m_callback->handleEvent(m_callbackArg.get());
+ }
+
+ private:
+ RefPtr<CB> m_callback;
+ RefPtr<CBArg> m_callbackArg;
+ };
+
String m_name;
mutable OwnPtr<AsyncFileSystem> m_asyncFileSystem;
};
+template <typename CB, typename CBArg>
+void DOMFileSystem::scheduleCallback(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<CB> callback, PassRefPtr<CBArg> arg)
+{
+ ASSERT(scriptExecutionContext->isContextThread());
+ scriptExecutionContext->postTask(new DispatchCallbackTask<CB, CBArg>(callback, arg));
+}
+
} // namespace
#endif // ENABLE(FILE_SYSTEM)
diff --git a/WebCore/storage/DirectoryEntry.cpp b/WebCore/storage/DirectoryEntry.cpp
index 60dcace..95c12e4 100644
--- a/WebCore/storage/DirectoryEntry.cpp
+++ b/WebCore/storage/DirectoryEntry.cpp
@@ -39,7 +39,7 @@
namespace WebCore {
-DirectoryEntry::DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+DirectoryEntry::DirectoryEntry(DOMFileSystem* fileSystem, const String& fullPath)
: Entry(fileSystem, fullPath)
{
}
@@ -49,16 +49,14 @@ PassRefPtr<DirectoryReader> DirectoryEntry::createReader()
return DirectoryReader::create(m_fileSystem, m_fullPath);
}
-void DirectoryEntry::getFile(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void DirectoryEntry::getFile(const String& path, PassRefPtr<Flags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->getFile(this, path, flags, successCallback, errorCallback);
}
-void DirectoryEntry::getDirectory(const String&, PassRefPtr<Flags>, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void DirectoryEntry::getDirectory(const String& path, PassRefPtr<Flags> flags, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->getDirectory(this, path, flags, successCallback, errorCallback);
}
} // namespace
diff --git a/WebCore/storage/DirectoryEntry.h b/WebCore/storage/DirectoryEntry.h
index 2ae4fb5..3cd8ab5 100644
--- a/WebCore/storage/DirectoryEntry.h
+++ b/WebCore/storage/DirectoryEntry.h
@@ -47,7 +47,7 @@ class ErrorCallback;
class DirectoryEntry : public Entry {
public:
- static PassRefPtr<DirectoryEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+ static PassRefPtr<DirectoryEntry> create(DOMFileSystem* fileSystem, const String& fullPath)
{
return adoptRef(new DirectoryEntry(fileSystem, fullPath));
}
@@ -58,7 +58,7 @@ public:
void getDirectory(const String& path, PassRefPtr<Flags> options = 0, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
private:
- DirectoryEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath);
+ DirectoryEntry(DOMFileSystem* fileSystem, const String& fullPath);
};
} // namespace
diff --git a/WebCore/storage/DirectoryReader.cpp b/WebCore/storage/DirectoryReader.cpp
index 0b30f70..b0eef1c 100644
--- a/WebCore/storage/DirectoryReader.cpp
+++ b/WebCore/storage/DirectoryReader.cpp
@@ -39,16 +39,15 @@
namespace WebCore {
-DirectoryReader::DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path)
+DirectoryReader::DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
: m_fileSystem(fileSystem)
- , m_path(path)
+ , m_fullPath(fullPath)
{
}
-void DirectoryReader::readEntries(PassRefPtr<EntriesCallback>, PassRefPtr<ErrorCallback>)
+void DirectoryReader::readEntries(PassRefPtr<EntriesCallback> entriesCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->readDirectory(m_fullPath, entriesCallback, errorCallback);
}
} // namespace
diff --git a/WebCore/storage/DirectoryReader.h b/WebCore/storage/DirectoryReader.h
index cf5da8f..0e2ef0f 100644
--- a/WebCore/storage/DirectoryReader.h
+++ b/WebCore/storage/DirectoryReader.h
@@ -56,7 +56,7 @@ private:
DirectoryReader(PassRefPtr<DOMFileSystem> fileSystem, const String& path);
RefPtr<DOMFileSystem> m_fileSystem;
- String m_path;
+ String m_fullPath;
};
} // namespace
diff --git a/WebCore/storage/Entry.cpp b/WebCore/storage/Entry.cpp
index 6783291..fbbedf2 100644
--- a/WebCore/storage/Entry.cpp
+++ b/WebCore/storage/Entry.cpp
@@ -32,15 +32,17 @@
#if ENABLE(FILE_SYSTEM)
+#include "DOMFilePath.h"
#include "DOMFileSystem.h"
#include "EntryCallback.h"
#include "ErrorCallback.h"
+#include "FileError.h"
#include "MetadataCallback.h"
#include "VoidCallback.h"
namespace WebCore {
-Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+Entry::Entry(DOMFileSystem* fileSystem, const String& fullPath)
: m_fileSystem(fileSystem)
, m_fullPath(fullPath)
{
@@ -51,34 +53,29 @@ Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
m_name = fullPath;
}
-void Entry::getMetadata(PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>)
+void Entry::getMetadata(PassRefPtr<MetadataCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->getMetadata(this, successCallback, errorCallback);
}
-void Entry::moveTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void Entry::moveTo(PassRefPtr<Entry> parent, const String& name, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) const
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->move(this, parent, name, successCallback, errorCallback);
}
-void Entry::copyTo(PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void Entry::copyTo(PassRefPtr<Entry> parent, const String& name, PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) const
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->copy(this, parent, name, successCallback, errorCallback);
}
-void Entry::remove(PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>)
+void Entry::remove(PassRefPtr<VoidCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) const
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->remove(this, successCallback, errorCallback);
}
-void Entry::getParent(PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>)
+void Entry::getParent(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) const
{
- // FIXME: to be implemented.
- ASSERT_NOT_REACHED();
+ m_fileSystem->getParent(this, successCallback, errorCallback);
}
String Entry::toURI(const String&)
diff --git a/WebCore/storage/Entry.h b/WebCore/storage/Entry.h
index 7bbb265..9af532f 100644
--- a/WebCore/storage/Entry.h
+++ b/WebCore/storage/Entry.h
@@ -54,22 +54,21 @@ public:
const String& fullPath() const { return m_fullPath; }
const String& name() const { return m_name; }
- DOMFileSystem* filesystem() const { return m_fileSystem.get(); }
+ DOMFileSystem* filesystem() const { return m_fileSystem; }
virtual void getMetadata(PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
-
- virtual void moveTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void copyTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void remove(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
- virtual void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0);
+ virtual void moveTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const;
+ virtual void copyTo(PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const;
+ virtual void remove(PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const;
+ virtual void getParent(PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0) const;
virtual String toURI(const String& mimeType = String());
protected:
- Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath);
+ Entry(DOMFileSystem* fileSystem, const String& fullPath);
- RefPtr<DOMFileSystem> m_fileSystem;
- String m_fullPath; // virtual path
+ DOMFileSystem* m_fileSystem;
+ String m_fullPath;
String m_name;
};
diff --git a/WebCore/storage/FileEntry.cpp b/WebCore/storage/FileEntry.cpp
index 4bec01d..e2a583c 100644
--- a/WebCore/storage/FileEntry.cpp
+++ b/WebCore/storage/FileEntry.cpp
@@ -35,7 +35,7 @@
namespace WebCore {
-FileEntry::FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+FileEntry::FileEntry(DOMFileSystem* fileSystem, const String& fullPath)
: Entry(fileSystem, fullPath)
{
}
diff --git a/WebCore/storage/FileEntry.h b/WebCore/storage/FileEntry.h
index b02b5c7..abcc6bb 100644
--- a/WebCore/storage/FileEntry.h
+++ b/WebCore/storage/FileEntry.h
@@ -34,9 +34,6 @@
#if ENABLE(FILE_SYSTEM)
#include "Entry.h"
-#include "PlatformString.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
namespace WebCore {
@@ -44,14 +41,14 @@ class DOMFileSystem;
class FileEntry : public Entry {
public:
- static PassRefPtr<FileEntry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath)
+ static PassRefPtr<FileEntry> create(DOMFileSystem* fileSystem, const String& fullPath)
{
return adoptRef(new FileEntry(fileSystem, fullPath));
}
virtual bool isFile() const { return true; }
private:
- FileEntry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath);
+ FileEntry(DOMFileSystem* fileSystem, const String& fullPath);
};
} // namespace
diff --git a/WebCore/storage/LocalFileSystem.cpp b/WebCore/storage/LocalFileSystem.cpp
index 282508e..59ec2a1 100644
--- a/WebCore/storage/LocalFileSystem.cpp
+++ b/WebCore/storage/LocalFileSystem.cpp
@@ -37,7 +37,8 @@
#if ENABLE(FILE_SYSTEM)
-#include "DOMWindow.h"
+#include "CrossThreadTask.h"
+#include "DOMFileSystem.h"
#include "ErrorCallback.h"
#include "ExceptionCode.h"
#include "FileError.h"
@@ -54,14 +55,20 @@ PassRefPtr<LocalFileSystem> LocalFileSystem::create(const String& basePath)
return adoptRef(new LocalFileSystem(basePath));
}
+static void openFileSystem(ScriptExecutionContext*, const String& basePath, const String& identifier, AsyncFileSystem::Type type, PassOwnPtr<FileSystemCallbacks> callbacks)
+{
+ AsyncFileSystem::openFileSystem(basePath, identifier, type, callbacks);
+}
+
void LocalFileSystem::requestFileSystem(ScriptExecutionContext* context, AsyncFileSystem::Type type, long long, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback)
{
if (type != AsyncFileSystem::Temporary && type != AsyncFileSystem::Persistent) {
- errorCallback->handleEvent(FileError::create(INVALID_MODIFICATION_ERR).get());
+ DOMFileSystem::scheduleCallback(context, errorCallback, FileError::create(INVALID_MODIFICATION_ERR));
return;
}
- AsyncFileSystem::openFileSystem(m_basePath, context->securityOrigin()->databaseIdentifier(), type, new FileSystemCallbacks(successCallback, errorCallback, context));
+ // AsyncFileSystem::openFileSystem calls callbacks synchronously, so the method needs to be called asynchronously.
+ context->postTask(createCallbackTask(&openFileSystem, m_basePath, context->securityOrigin()->databaseIdentifier(), type, new FileSystemCallbacks(successCallback, errorCallback, context)));
}
} // namespace
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 90d9460..01a2bbf 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,23 @@
+2010-08-30 Kinuko Yasuda <kinuko at chromium.osrc>
+
+ Reviewed by Darin Fisher.
+
+ Add DOMFileSystem implementation to support Entry manipulation operations
+ https://bugs.webkit.org/show_bug.cgi?id=44732
+
+ Fixed virtual-path / platform-path conversion timing. (The conversion needs to be done before calling AsyncFileSystem methods to support cross-filesystem operations.)
+
+ * src/AsyncFileSystemChromium.cpp:
+ (WebCore::AsyncFileSystemChromium::move):
+ (WebCore::AsyncFileSystemChromium::copy):
+ (WebCore::AsyncFileSystemChromium::remove):
+ (WebCore::AsyncFileSystemChromium::readMetadata):
+ (WebCore::AsyncFileSystemChromium::createFile):
+ (WebCore::AsyncFileSystemChromium::createDirectory):
+ (WebCore::AsyncFileSystemChromium::fileExists):
+ (WebCore::AsyncFileSystemChromium::directoryExists):
+ (WebCore::AsyncFileSystemChromium::readDirectory):
+
2010-08-30 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r66198.
diff --git a/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/WebKit/chromium/src/AsyncFileSystemChromium.cpp
index c783918..08fcea6 100644
--- a/WebKit/chromium/src/AsyncFileSystemChromium.cpp
+++ b/WebKit/chromium/src/AsyncFileSystemChromium.cpp
@@ -56,47 +56,47 @@ AsyncFileSystemChromium::~AsyncFileSystemChromium()
void AsyncFileSystemChromium::move(const String& srcPath, const String& destPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->move(virtualToPlatformPath(srcPath), virtualToPlatformPath(destPath), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->move(srcPath, destPath, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::copy(const String& srcPath, const String& destPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->copy(virtualToPlatformPath(srcPath), virtualToPlatformPath(destPath), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->copy(srcPath, destPath, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::remove(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->remove(virtualToPlatformPath(path), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->remove(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::readMetadata(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->readMetadata(virtualToPlatformPath(path), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->readMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::createFile(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->createFile(virtualToPlatformPath(path), exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->createFile(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::createDirectory(const String& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->createDirectory(virtualToPlatformPath(path), exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->createDirectory(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::fileExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->fileExists(virtualToPlatformPath(path), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->fileExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::directoryExists(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->directoryExists(virtualToPlatformPath(path), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
void AsyncFileSystemChromium::readDirectory(const String& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
- m_webFileSystem->readDirectory(virtualToPlatformPath(path), new WebKit::WebFileSystemCallbacksImpl(callbacks));
+ m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list