| Index: third_party/WebKit/Source/modules/filesystem/FileSystem.cpp
|
| diff --git a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp b/third_party/WebKit/Source/modules/filesystem/FileSystem.cpp
|
| similarity index 69%
|
| rename from third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
|
| rename to third_party/WebKit/Source/modules/filesystem/FileSystem.cpp
|
| index a209202208975a99bd6531a92c33ed27b2957a76..1ddb58a97e10ae4ac36799c774f777fbbda90e3d 100644
|
| --- a/third_party/WebKit/Source/modules/filesystem/DOMFileSystem.cpp
|
| +++ b/third_party/WebKit/Source/modules/filesystem/FileSystem.cpp
|
| @@ -28,17 +28,17 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#include "modules/filesystem/DOMFileSystem.h"
|
| +#include "modules/filesystem/FileSystem.h"
|
|
|
| #include "core/fileapi/BlobCallback.h"
|
| #include "modules/filesystem/DOMFilePath.h"
|
| -#include "modules/filesystem/DirectoryEntry.h"
|
| -#include "modules/filesystem/FileEntry.h"
|
| #include "modules/filesystem/FileSystemCallbacks.h"
|
| +#include "modules/filesystem/FileSystemDirectoryEntry.h"
|
| +#include "modules/filesystem/FileSystemFileEntry.h"
|
| +#include "modules/filesystem/FileSystemMetadataCallback.h"
|
| #include "modules/filesystem/FileWriter.h"
|
| #include "modules/filesystem/FileWriterBaseCallback.h"
|
| #include "modules/filesystem/FileWriterCallback.h"
|
| -#include "modules/filesystem/MetadataCallback.h"
|
| #include "platform/FileMetadata.h"
|
| #include "platform/weborigin/SecurityOrigin.h"
|
| #include "public/platform/Platform.h"
|
| @@ -52,18 +52,17 @@
|
| namespace blink {
|
|
|
| // static
|
| -DOMFileSystem* DOMFileSystem::create(ExecutionContext* context,
|
| - const String& name,
|
| - FileSystemType type,
|
| - const KURL& rootURL) {
|
| - DOMFileSystem* fileSystem(new DOMFileSystem(context, name, type, rootURL));
|
| +FileSystem* FileSystem::create(ExecutionContext* context,
|
| + const String& name,
|
| + FileSystemType type,
|
| + const KURL& rootURL) {
|
| + FileSystem* fileSystem(new FileSystem(context, name, type, rootURL));
|
| fileSystem->suspendIfNeeded();
|
| return fileSystem;
|
| }
|
|
|
| -DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(
|
| - ExecutionContext* context,
|
| - const String& filesystemId) {
|
| +FileSystem* FileSystem::createIsolatedFileSystem(ExecutionContext* context,
|
| + const String& filesystemId) {
|
| if (filesystemId.isEmpty())
|
| return 0;
|
|
|
| @@ -84,52 +83,53 @@ DOMFileSystem* DOMFileSystem::createIsolatedFileSystem(
|
| rootURL.append(filesystemId);
|
| rootURL.append('/');
|
|
|
| - return DOMFileSystem::create(context, filesystemName.toString(),
|
| - FileSystemTypeIsolated,
|
| - KURL(ParsedURLString, rootURL.toString()));
|
| + return FileSystem::create(context, filesystemName.toString(),
|
| + FileSystemTypeIsolated,
|
| + KURL(ParsedURLString, rootURL.toString()));
|
| }
|
|
|
| -DOMFileSystem::DOMFileSystem(ExecutionContext* context,
|
| - const String& name,
|
| - FileSystemType type,
|
| - const KURL& rootURL)
|
| - : DOMFileSystemBase(context, name, type, rootURL),
|
| +FileSystem::FileSystem(ExecutionContext* context,
|
| + const String& name,
|
| + FileSystemType type,
|
| + const KURL& rootURL)
|
| + : FileSystemBase(context, name, type, rootURL),
|
| ActiveScriptWrappable(this),
|
| ActiveDOMObject(context),
|
| m_numberOfPendingCallbacks(0),
|
| - m_rootEntry(DirectoryEntry::create(this, DOMFilePath::root)) {}
|
| + m_rootEntry(FileSystemDirectoryEntry::create(this, DOMFilePath::root)) {}
|
|
|
| -DirectoryEntry* DOMFileSystem::root() const {
|
| +FileSystemDirectoryEntry* FileSystem::root() const {
|
| return m_rootEntry.get();
|
| }
|
|
|
| -void DOMFileSystem::addPendingCallbacks() {
|
| +void FileSystem::addPendingCallbacks() {
|
| ++m_numberOfPendingCallbacks;
|
| }
|
|
|
| -void DOMFileSystem::removePendingCallbacks() {
|
| - ASSERT(m_numberOfPendingCallbacks > 0);
|
| +void FileSystem::removePendingCallbacks() {
|
| + DCHECK_GT(m_numberOfPendingCallbacks, 0);
|
| --m_numberOfPendingCallbacks;
|
| }
|
|
|
| -bool DOMFileSystem::hasPendingActivity() const {
|
| - ASSERT(m_numberOfPendingCallbacks >= 0);
|
| +bool FileSystem::hasPendingActivity() const {
|
| + DCHECK_GE(m_numberOfPendingCallbacks, 0);
|
| return m_numberOfPendingCallbacks;
|
| }
|
|
|
| -void DOMFileSystem::reportError(ErrorCallbackBase* errorCallback,
|
| - FileError::ErrorCode fileError) {
|
| +void FileSystem::reportError(ErrorCallbackBase* errorCallback,
|
| + FileError::ErrorCode fileError) {
|
| reportError(getExecutionContext(), errorCallback, fileError);
|
| }
|
|
|
| -void DOMFileSystem::reportError(ExecutionContext* executionContext,
|
| - ErrorCallbackBase* errorCallback,
|
| - FileError::ErrorCode fileError) {
|
| - if (errorCallback)
|
| +void FileSystem::reportError(ExecutionContext* executionContext,
|
| + ErrorCallbackBase* errorCallback,
|
| + FileError::ErrorCode fileError) {
|
| + if (errorCallback) {
|
| scheduleCallback(
|
| executionContext,
|
| createSameThreadTask(&ErrorCallbackBase::invoke,
|
| wrapPersistent(errorCallback), fileError));
|
| + }
|
| }
|
|
|
| namespace {
|
| @@ -157,10 +157,10 @@ class ConvertToFileWriterCallback : public FileWriterBaseCallback {
|
|
|
| } // namespace
|
|
|
| -void DOMFileSystem::createWriter(const FileEntry* fileEntry,
|
| - FileWriterCallback* successCallback,
|
| - ErrorCallbackBase* errorCallback) {
|
| - ASSERT(fileEntry);
|
| +void FileSystem::createWriter(const FileSystemFileEntry* fileEntry,
|
| + FileWriterCallback* successCallback,
|
| + ErrorCallbackBase* errorCallback) {
|
| + DCHECK(fileEntry);
|
|
|
| if (!fileSystem()) {
|
| reportError(errorCallback, FileError::kAbortErr);
|
| @@ -177,9 +177,9 @@ void DOMFileSystem::createWriter(const FileEntry* fileEntry,
|
| std::move(callbacks));
|
| }
|
|
|
| -void DOMFileSystem::createFile(const FileEntry* fileEntry,
|
| - BlobCallback* successCallback,
|
| - ErrorCallbackBase* errorCallback) {
|
| +void FileSystem::createFile(const FileSystemFileEntry* fileEntry,
|
| + BlobCallback* successCallback,
|
| + ErrorCallbackBase* errorCallback) {
|
| KURL fileSystemURL = createFileSystemURL(fileEntry);
|
| if (!fileSystem()) {
|
| reportError(errorCallback, FileError::kAbortErr);
|
| @@ -192,8 +192,8 @@ void DOMFileSystem::createFile(const FileEntry* fileEntry,
|
| successCallback, errorCallback, m_context));
|
| }
|
|
|
| -DEFINE_TRACE(DOMFileSystem) {
|
| - DOMFileSystemBase::trace(visitor);
|
| +DEFINE_TRACE(FileSystem) {
|
| + FileSystemBase::trace(visitor);
|
| ActiveDOMObject::trace(visitor);
|
| visitor->trace(m_rootEntry);
|
| }
|
|
|