| Index: webkit/browser/fileapi/file_system_context.cc
|
| diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc
|
| index f6e7df3a2d6d532075a406f9c61f4b7c8ecd2b4a..4631b79b8a7558b4dcadc8a643c152a952a4269e 100644
|
| --- a/webkit/browser/fileapi/file_system_context.cc
|
| +++ b/webkit/browser/fileapi/file_system_context.cc
|
| @@ -57,6 +57,18 @@ void DidGetMetadataForResolveURL(
|
| callback.Run(error, info, path, file_info.is_directory);
|
| }
|
|
|
| +void RelayResolveURLCallback(
|
| + scoped_refptr<base::MessageLoopProxy> message_loop,
|
| + const FileSystemContext::ResolveURLCallback& callback,
|
| + base::File::Error result,
|
| + const FileSystemInfo& info,
|
| + const base::FilePath& file_path,
|
| + bool is_directory) {
|
| + message_loop->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(callback, result, info, file_path, is_directory));
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| @@ -322,11 +334,19 @@ void FileSystemContext::OpenFileSystem(
|
| void FileSystemContext::ResolveURL(
|
| const FileSystemURL& url,
|
| const ResolveURLCallback& callback) {
|
| - // TODO(nhiroki, kinuko): Remove this thread restriction, so it can be called
|
| - // on either UI or IO thread.
|
| - DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
|
| DCHECK(!callback.is_null());
|
|
|
| + // If not on IO thread, forward before passing the task to the backend.
|
| + if (!io_task_runner_->RunsTasksOnCurrentThread()) {
|
| + ResolveURLCallback relay_callback =
|
| + base::Bind(&RelayResolveURLCallback,
|
| + base::MessageLoopProxy::current(), callback);
|
| + io_task_runner_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&FileSystemContext::ResolveURL, this, url, relay_callback));
|
| + return;
|
| + }
|
| +
|
| FileSystemBackend* backend = GetFileSystemBackend(url.type());
|
| if (!backend) {
|
| callback.Run(base::File::FILE_ERROR_SECURITY,
|
|
|