summaryrefslogtreecommitdiffstats
path: root/WebCore/fileapi/FileSystemCallbacks.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-10-22 13:02:20 +0100
committerBen Murdoch <benm@google.com>2010-10-26 15:21:41 +0100
commita94275402997c11dd2e778633dacf4b7e630a35d (patch)
treee66f56c67e3b01f22c9c23cd932271ee9ac558ed /WebCore/fileapi/FileSystemCallbacks.cpp
parent09e26c78506587b3f5d930d7bc72a23287ffbec0 (diff)
downloadexternal_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.zip
external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.gz
external_webkit-a94275402997c11dd2e778633dacf4b7e630a35d.tar.bz2
Merge WebKit at r70209: Initial merge by Git
Change-Id: Id23a68efa36e9d1126bcce0b137872db00892c8e
Diffstat (limited to 'WebCore/fileapi/FileSystemCallbacks.cpp')
-rw-r--r--WebCore/fileapi/FileSystemCallbacks.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/WebCore/fileapi/FileSystemCallbacks.cpp b/WebCore/fileapi/FileSystemCallbacks.cpp
index 550b509..e5f404e 100644
--- a/WebCore/fileapi/FileSystemCallbacks.cpp
+++ b/WebCore/fileapi/FileSystemCallbacks.cpp
@@ -36,8 +36,9 @@
#include "AsyncFileSystem.h"
#include "AsyncFileWriter.h"
#include "DOMFilePath.h"
-#include "DOMFileSystem.h"
+#include "DOMFileSystemBase.h"
#include "DirectoryEntry.h"
+#include "DirectoryReader.h"
#include "EntriesCallback.h"
#include "EntryArray.h"
#include "EntryCallback.h"
@@ -110,12 +111,12 @@ void FileSystemCallbacksBase::didFail(int code)
// EntryCallbacks -------------------------------------------------------------
-PassOwnPtr<EntryCallbacks> EntryCallbacks::create(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& expectedPath, bool isDirectory)
+PassOwnPtr<EntryCallbacks> EntryCallbacks::create(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory)
{
return adoptPtr(new EntryCallbacks(successCallback, errorCallback, fileSystem, expectedPath, isDirectory));
}
-EntryCallbacks::EntryCallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& expectedPath, bool isDirectory)
+EntryCallbacks::EntryCallbacks(PassRefPtr<EntryCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystemBase* fileSystem, const String& expectedPath, bool isDirectory)
: FileSystemCallbacksBase(errorCallback)
, m_successCallback(successCallback)
, m_fileSystem(fileSystem)
@@ -137,39 +138,34 @@ void EntryCallbacks::didSucceed()
// EntriesCallbacks -----------------------------------------------------------
-PassOwnPtr<EntriesCallbacks> EntriesCallbacks::create(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& basePath)
+PassOwnPtr<EntriesCallbacks> EntriesCallbacks::create(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DirectoryReaderBase* directoryReader, const String& basePath)
{
- return adoptPtr(new EntriesCallbacks(successCallback, errorCallback, fileSystem, basePath));
+ return adoptPtr(new EntriesCallbacks(successCallback, errorCallback, directoryReader, basePath));
}
-EntriesCallbacks::EntriesCallbacks(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DOMFileSystem* fileSystem, const String& basePath)
+EntriesCallbacks::EntriesCallbacks(PassRefPtr<EntriesCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback, DirectoryReaderBase* directoryReader, const String& basePath)
: FileSystemCallbacksBase(errorCallback)
, m_successCallback(successCallback)
- , m_fileSystem(fileSystem)
+ , m_directoryReader(directoryReader)
, m_basePath(basePath)
, m_entries(EntryArray::create())
{
+ ASSERT(m_directoryReader);
}
void EntriesCallbacks::didReadDirectoryEntry(const String& name, bool isDirectory)
{
if (isDirectory)
- m_entries->append(DirectoryEntry::create(m_fileSystem, DOMFilePath::append(m_basePath, name)));
+ m_entries->append(DirectoryEntry::create(m_directoryReader->filesystem(), DOMFilePath::append(m_basePath, name)));
else
- m_entries->append(FileEntry::create(m_fileSystem, DOMFilePath::append(m_basePath, name)));
+ m_entries->append(FileEntry::create(m_directoryReader->filesystem(), DOMFilePath::append(m_basePath, name)));
}
void EntriesCallbacks::didReadDirectoryEntries(bool hasMore)
{
- if (m_successCallback) {
+ m_directoryReader->setHasMoreEntries(hasMore);
+ if (m_successCallback)
m_successCallback->handleEvent(m_entries.get());
- if (!m_entries->isEmpty() && !hasMore) {
- // If we have returned some entries and there're no more coming entries (hasMore==false), call back once more with an empty array.
- m_successCallback->handleEvent(EntryArray::create().get());
- m_successCallback.clear();
- }
- m_entries->clear();
- }
}
// FileSystemCallbacks --------------------------------------------------------