summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/fileapi')
-rw-r--r--webkit/fileapi/file_system_context.cc15
-rw-r--r--webkit/fileapi/file_system_context.h6
-rw-r--r--webkit/fileapi/file_system_dir_url_request_job.cc23
-rw-r--r--webkit/fileapi/file_system_dir_url_request_job.h2
-rw-r--r--webkit/fileapi/file_system_file_stream_reader.cc7
-rw-r--r--webkit/fileapi/file_system_url_request_job.cc7
-rw-r--r--webkit/fileapi/isolated_file_util_unittest.cc6
-rw-r--r--webkit/fileapi/media/native_media_file_util_unittest.cc2
-rw-r--r--webkit/fileapi/sandbox_file_stream_writer.cc6
9 files changed, 21 insertions, 53 deletions
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
index 4561515..4a9fe7a 100644
--- a/webkit/fileapi/file_system_context.cc
+++ b/webkit/fileapi/file_system_context.cc
@@ -202,22 +202,13 @@ void FileSystemContext::DeleteFileSystem(
}
FileSystemOperation* FileSystemContext::CreateFileSystemOperation(
- const FileSystemURL& url, PlatformFileError* error_code) {
- if (!url.is_valid()) {
- if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_INVALID_URL;
+ const FileSystemURL& url) {
+ if (!url.is_valid())
return NULL;
- }
FileSystemMountPointProvider* mount_point_provider =
GetMountPointProvider(url.type());
- if (!mount_point_provider) {
- if (error_code)
- *error_code = base::PLATFORM_FILE_ERROR_FAILED;
+ if (!mount_point_provider)
return NULL;
- }
-
- if (error_code)
- *error_code = base::PLATFORM_FILE_OK;
return mount_point_provider->CreateFileSystemOperation(url, this);
}
diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h
index abd3e7d..dfb5664 100644
--- a/webkit/fileapi/file_system_context.h
+++ b/webkit/fileapi/file_system_context.h
@@ -50,7 +50,7 @@ class FILEAPI_EXPORT FileSystemContext
DefaultContextDeleter> {
public:
// task_runners->file_task_runner() is used as default TaskRunner.
- // Unless a MountPointProvider is overridden in CreateFileSystemOperation,
+ // Unless a MountPointProvired is override in CreateFileSystemOperation,
// it is used for all file operations and file related meta operations.
// The code assumes that
// task_runners->file_task_runner()->RunsTasksOnCurrentThread()
@@ -129,9 +129,7 @@ class FILEAPI_EXPORT FileSystemContext
// and calling the provider's corresponding CreateFileSystemOperation method.
// The resolved MountPointProvider could perform further specialization
// depending on the filesystem type pointed by the |url|.
- FileSystemOperation* CreateFileSystemOperation(
- const FileSystemURL& url,
- base::PlatformFileError* error_code);
+ FileSystemOperation* CreateFileSystemOperation(const FileSystemURL& url);
// Creates new FileStreamReader instance to read a file pointed by the given
// filesystem URL |url| starting from |offset|.
diff --git a/webkit/fileapi/file_system_dir_url_request_job.cc b/webkit/fileapi/file_system_dir_url_request_job.cc
index 1be9394..b0c9d8f 100644
--- a/webkit/fileapi/file_system_dir_url_request_job.cc
+++ b/webkit/fileapi/file_system_dir_url_request_job.cc
@@ -80,11 +80,10 @@ void FileSystemDirURLRequestJob::StartAsync() {
if (!request_)
return;
url_ = FileSystemURL(request_->url());
- base::PlatformFileError error_code;
- FileSystemOperation* operation = GetNewOperation(&error_code);
- if (error_code != base::PLATFORM_FILE_OK) {
+ FileSystemOperation* operation = GetNewOperation();
+ if (!operation) {
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
- net::PlatformFileErrorToNetError(error_code)));
+ net::ERR_INVALID_URL));
return;
}
operation->ReadDirectory(
@@ -125,16 +124,7 @@ void FileSystemDirURLRequestJob::DidReadDirectory(
}
if (has_more) {
- base::PlatformFileError error_code;
- FileSystemOperation* operation = GetNewOperation(&error_code);
- if (error_code != base::PLATFORM_FILE_OK) {
- NotifyDone(URLRequestStatus(
- URLRequestStatus::FAILED,
- net::PlatformFileErrorToNetError(error_code)));
- return;
- }
-
- operation->ReadDirectory(
+ GetNewOperation()->ReadDirectory(
url_,
base::Bind(&FileSystemDirURLRequestJob::DidReadDirectory, this));
} else {
@@ -143,9 +133,8 @@ void FileSystemDirURLRequestJob::DidReadDirectory(
}
}
-FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation(
- base::PlatformFileError* error_code) {
- return file_system_context_->CreateFileSystemOperation(url_, error_code);
+FileSystemOperation* FileSystemDirURLRequestJob::GetNewOperation() {
+ return file_system_context_->CreateFileSystemOperation(url_);
}
} // namespace fileapi
diff --git a/webkit/fileapi/file_system_dir_url_request_job.h b/webkit/fileapi/file_system_dir_url_request_job.h
index c5b4aca..84e67ec 100644
--- a/webkit/fileapi/file_system_dir_url_request_job.h
+++ b/webkit/fileapi/file_system_dir_url_request_job.h
@@ -52,7 +52,7 @@ class FILEAPI_EXPORT_PRIVATE FileSystemDirURLRequestJob
void DidReadDirectory(base::PlatformFileError result,
const std::vector<base::FileUtilProxy::Entry>& entries,
bool has_more);
- FileSystemOperation* GetNewOperation(base::PlatformFileError* error_code);
+ FileSystemOperation* GetNewOperation();
std::string data_;
FileSystemURL url_;
diff --git a/webkit/fileapi/file_system_file_stream_reader.cc b/webkit/fileapi/file_system_file_stream_reader.cc
index ef0a915..d1e5220 100644
--- a/webkit/fileapi/file_system_file_stream_reader.cc
+++ b/webkit/fileapi/file_system_file_stream_reader.cc
@@ -53,11 +53,10 @@ int FileSystemFileStreamReader::Read(
if (local_file_reader_.get())
return local_file_reader_->Read(buf, buf_len, callback);
DCHECK(!has_pending_create_snapshot_);
- base::PlatformFileError error_code;
FileSystemOperation* operation =
- file_system_context_->CreateFileSystemOperation(url_, &error_code);
- if (error_code != base::PLATFORM_FILE_OK)
- return net::PlatformFileErrorToNetError(error_code);
+ file_system_context_->CreateFileSystemOperation(url_);
+ if (!operation)
+ return net::ERR_INVALID_URL;
has_pending_create_snapshot_ = true;
operation->CreateSnapshotFile(
url_,
diff --git a/webkit/fileapi/file_system_url_request_job.cc b/webkit/fileapi/file_system_url_request_job.cc
index 959c01b..c26a4d7 100644
--- a/webkit/fileapi/file_system_url_request_job.cc
+++ b/webkit/fileapi/file_system_url_request_job.cc
@@ -157,12 +157,11 @@ void FileSystemURLRequestJob::StartAsync() {
return;
DCHECK(!reader_.get());
url_ = FileSystemURL(request_->url());
- base::PlatformFileError error_code;
FileSystemOperation* operation =
- file_system_context_->CreateFileSystemOperation(url_, &error_code);
- if (error_code != base::PLATFORM_FILE_OK) {
+ file_system_context_->CreateFileSystemOperation(url_);
+ if (!operation) {
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
- net::PlatformFileErrorToNetError(error_code)));
+ net::ERR_INVALID_URL));
return;
}
operation->GetMetadata(
diff --git a/webkit/fileapi/isolated_file_util_unittest.cc b/webkit/fileapi/isolated_file_util_unittest.cc
index f6ddaad..03953c8 100644
--- a/webkit/fileapi/isolated_file_util_unittest.cc
+++ b/webkit/fileapi/isolated_file_util_unittest.cc
@@ -304,11 +304,7 @@ TEST_F(IsolatedFileUtilTest, UnregisteredPathsTest) {
ASSERT_FALSE(url.is_valid());
// We should not be able to create a new operation for an invalid URL.
- base::PlatformFileError error_code;
- FileSystemOperation* operation =
- file_system_context()->CreateFileSystemOperation(url, &error_code);
- ASSERT_EQ(NULL, operation);
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_INVALID_URL, error_code);
+ ASSERT_EQ(NULL, file_system_context()->CreateFileSystemOperation(url));
}
}
diff --git a/webkit/fileapi/media/native_media_file_util_unittest.cc b/webkit/fileapi/media/native_media_file_util_unittest.cc
index f14c7aa..ab88b31 100644
--- a/webkit/fileapi/media/native_media_file_util_unittest.cc
+++ b/webkit/fileapi/media/native_media_file_util_unittest.cc
@@ -140,7 +140,7 @@ class NativeMediaFileUtilTest : public testing::Test {
}
FileSystemOperation* NewOperation(const FileSystemURL& url) {
- return file_system_context_->CreateFileSystemOperation(url, NULL);
+ return file_system_context_->CreateFileSystemOperation(url);
}
private:
diff --git a/webkit/fileapi/sandbox_file_stream_writer.cc b/webkit/fileapi/sandbox_file_stream_writer.cc
index a12e00e..2dafb58 100644
--- a/webkit/fileapi/sandbox_file_stream_writer.cc
+++ b/webkit/fileapi/sandbox_file_stream_writer.cc
@@ -66,12 +66,8 @@ int SandboxFileStreamWriter::Write(
if (local_file_writer_.get())
return WriteInternal(buf, buf_len, callback);
- base::PlatformFileError error_code;
FileSystemOperation* operation =
- file_system_context_->CreateFileSystemOperation(url_, &error_code);
- if (error_code != base::PLATFORM_FILE_OK)
- return net::PlatformFileErrorToNetError(error_code);
-
+ file_system_context_->CreateFileSystemOperation(url_);
DCHECK(operation);
net::CompletionCallback write_task =
base::Bind(&SandboxFileStreamWriter::DidInitializeForWrite,