Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(780)

Unified Diff: webkit/fileapi/file_system_context.cc

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixesz Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/file_system_context.cc
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc
index e64f4979edbc420f1892881799b0d9e1d748ec00..281d144a8a86fc07574cfe7849b9e663435723d2 100644
--- a/webkit/fileapi/file_system_context.cc
+++ b/webkit/fileapi/file_system_context.cc
@@ -6,7 +6,7 @@
#include "base/bind.h"
#include "base/file_util.h"
-#include "base/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "googleurl/src/gurl.h"
#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_interface.h"
@@ -29,10 +29,10 @@ namespace fileapi {
namespace {
QuotaClient* CreateQuotaClient(
- scoped_refptr<base::MessageLoopProxy> file_message_loop,
+ base::SequencedTaskRunner* file_task_runner,
FileSystemContext* context,
bool is_incognito) {
- return new FileSystemQuotaClient(file_message_loop, context, is_incognito);
+ return new FileSystemQuotaClient(file_task_runner, context, is_incognito);
}
void DidOpenFileSystem(FileSystemContext::OpenFileSystemCallback callback,
@@ -45,24 +45,24 @@ void DidOpenFileSystem(FileSystemContext::OpenFileSystemCallback callback,
} // anonymous namespace
FileSystemContext::FileSystemContext(
- scoped_refptr<base::MessageLoopProxy> file_message_loop,
- scoped_refptr<base::MessageLoopProxy> io_message_loop,
- scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
+ base::SequencedTaskRunner* file_task_runner,
+ base::SingleThreadTaskRunner* io_task_runner,
+ quota::SpecialStoragePolicy* special_storage_policy,
quota::QuotaManagerProxy* quota_manager_proxy,
const FilePath& profile_path,
const FileSystemOptions& options)
- : file_message_loop_(file_message_loop),
- io_message_loop_(io_message_loop),
+ : file_task_runner_(file_task_runner),
+ io_task_runner_(io_task_runner),
quota_manager_proxy_(quota_manager_proxy),
sandbox_provider_(
new SandboxMountPointProvider(
- file_message_loop,
+ file_task_runner,
profile_path,
options)),
isolated_provider_(new IsolatedMountPointProvider) {
if (quota_manager_proxy) {
quota_manager_proxy->RegisterClient(CreateQuotaClient(
- file_message_loop, this, options.is_incognito()));
+ file_task_runner, this, options.is_incognito()));
}
#if defined(OS_CHROMEOS)
external_provider_.reset(
@@ -75,7 +75,7 @@ FileSystemContext::~FileSystemContext() {
bool FileSystemContext::DeleteDataForOriginOnFileThread(
const GURL& origin_url) {
- DCHECK(file_message_loop_->BelongsToCurrentThread());
+ DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
DCHECK(sandbox_provider());
// Delete temporary and persistent data.
@@ -88,7 +88,7 @@ bool FileSystemContext::DeleteDataForOriginOnFileThread(
bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread(
const GURL& origin_url, FileSystemType type) {
- DCHECK(file_message_loop_->BelongsToCurrentThread());
+ DCHECK(file_task_runner_->RunsTasksOnCurrentThread());
if (type == fileapi::kFileSystemTypeTemporary ||
type == fileapi::kFileSystemTypePersistent) {
DCHECK(sandbox_provider());
@@ -145,8 +145,8 @@ FileSystemContext::external_provider() const {
}
void FileSystemContext::DeleteOnCorrectThread() const {
- if (!io_message_loop_->BelongsToCurrentThread() &&
- io_message_loop_->DeleteSoon(FROM_HERE, this)) {
+ if (!io_task_runner_->RunsTasksOnCurrentThread() &&
+ io_task_runner_->DeleteSoon(FROM_HERE, this)) {
return;
}
delete this;
@@ -175,8 +175,7 @@ void FileSystemContext::OpenFileSystem(
}
FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation(
- const GURL& url,
- base::MessageLoopProxy* file_proxy) {
+ const GURL& url) {
GURL origin_url;
FileSystemType file_system_type = kFileSystemTypeUnknown;
FilePath file_path;
@@ -187,13 +186,12 @@ FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation(
if (!mount_point_provider)
return NULL;
return mount_point_provider->CreateFileSystemOperation(
- origin_url, file_system_type, file_path, file_proxy, this);
+ origin_url, file_system_type, file_path, file_task_runner_, this);
michaeln 2012/04/27 22:31:08 sgtm to pass in the 'runner' the context was ctor'
kinuko 2012/05/04 19:05:35 Done.
}
webkit_blob::FileReader* FileSystemContext::CreateFileReader(
const GURL& url,
- int64 offset,
- base::MessageLoopProxy* file_proxy) {
+ int64 offset) {
GURL origin_url;
FileSystemType file_system_type = kFileSystemTypeUnknown;
FilePath file_path;
@@ -203,7 +201,8 @@ webkit_blob::FileReader* FileSystemContext::CreateFileReader(
GetMountPointProvider(file_system_type);
if (!mount_point_provider)
return NULL;
- return mount_point_provider->CreateFileReader(url, offset, file_proxy, this);
+ return mount_point_provider->CreateFileReader(url, offset,
+ file_task_runner_, this);
}
} // namespace fileapi

Powered by Google App Engine
This is Rietveld 408576698