summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync_file_system/local
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/sync_file_system/local')
-rw-r--r--chrome/browser/sync_file_system/local/canned_syncable_file_system.cc30
-rw-r--r--chrome/browser/sync_file_system/local/local_file_sync_context.cc129
-rw-r--r--chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc2
-rw-r--r--chrome/browser/sync_file_system/local/local_file_sync_service.cc9
-rw-r--r--chrome/browser/sync_file_system/local/root_delete_helper.cc4
-rw-r--r--chrome/browser/sync_file_system/local/sync_file_system_backend.cc10
6 files changed, 74 insertions, 110 deletions
diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
index 309a53a..3c09c35 100644
--- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
+++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
@@ -69,9 +69,9 @@ R RunOnThread(
task_runner->PostTask(
location,
base::Bind(task, base::Bind(&AssignAndQuit<R>,
- base::ThreadTaskRunnerHandle::Get(),
- run_loop.QuitClosure(),
- &result)));
+ base::RetainedRef(
+ base::ThreadTaskRunnerHandle::Get()),
+ run_loop.QuitClosure(), &result)));
run_loop.Run();
return result;
}
@@ -99,7 +99,7 @@ void VerifySameTaskRunner(
ASSERT_TRUE(runner1 != nullptr);
ASSERT_TRUE(runner2 != nullptr);
runner1->PostTask(FROM_HERE,
- base::Bind(&EnsureRunningOn, make_scoped_refptr(runner2)));
+ base::Bind(&EnsureRunningOn, base::RetainedRef(runner2)));
}
void OnCreateSnapshotFileAndVerifyData(
@@ -292,12 +292,12 @@ File::Error CannedSyncableFileSystem::OpenFileSystem() {
base::RunLoop run_loop;
io_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&CannedSyncableFileSystem::DoOpenFileSystem,
- base::Unretained(this),
- base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
- base::Unretained(this),
- base::ThreadTaskRunnerHandle::Get(),
- run_loop.QuitClosure())));
+ base::Bind(
+ &CannedSyncableFileSystem::DoOpenFileSystem, base::Unretained(this),
+ base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
+ base::Unretained(this),
+ base::RetainedRef(base::ThreadTaskRunnerHandle::Get()),
+ run_loop.QuitClosure())));
run_loop.Run();
if (backend()->sync_context()) {
@@ -738,12 +738,10 @@ void CannedSyncableFileSystem::DidOpenFileSystem(
if (!original_task_runner->RunsTasksOnCurrentThread()) {
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
original_task_runner->PostTask(
- FROM_HERE,
- base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
- base::Unretained(this),
- make_scoped_refptr(original_task_runner),
- quit_closure,
- root, name, result));
+ FROM_HERE, base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
+ base::Unretained(this),
+ base::RetainedRef(original_task_runner),
+ quit_closure, root, name, result));
return;
}
result_ = result;
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context.cc b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
index d0b9aa6..22c008e 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context.cc
@@ -86,9 +86,7 @@ void LocalFileSyncContext::MaybeInitializeFileSystemContext(
// CREATE_IF_NONEXISTENT here.
storage::FileSystemBackend::OpenFileSystemCallback open_filesystem_callback =
base::Bind(&LocalFileSyncContext::InitializeFileSystemContextOnIOThread,
- this,
- source_url,
- make_scoped_refptr(file_system_context));
+ this, source_url, base::RetainedRef(file_system_context));
io_task_runner_->PostTask(
FROM_HERE,
base::Bind(&storage::SandboxFileSystemBackendDelegate::OpenFileSystem,
@@ -115,12 +113,11 @@ void LocalFileSyncContext::GetFileForLocalSync(
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
base::PostTaskAndReplyWithResult(
- file_system_context->default_file_task_runner(),
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::GetNextURLsForSyncOnFileThread,
- this, make_scoped_refptr(file_system_context)),
- base::Bind(&LocalFileSyncContext::TryPrepareForLocalSync,
- this, make_scoped_refptr(file_system_context), callback));
+ file_system_context->default_file_task_runner(), FROM_HERE,
+ base::Bind(&LocalFileSyncContext::GetNextURLsForSyncOnFileThread, this,
+ base::RetainedRef(file_system_context)),
+ base::Bind(&LocalFileSyncContext::TryPrepareForLocalSync, this,
+ base::RetainedRef(file_system_context), callback));
}
void LocalFileSyncContext::ClearChangesForURL(
@@ -134,9 +131,8 @@ void LocalFileSyncContext::ClearChangesForURL(
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
file_system_context->default_file_task_runner()->PostTask(
FROM_HERE,
- base::Bind(&LocalFileSyncContext::ClearChangesForURL,
- this, make_scoped_refptr(file_system_context),
- url, done_callback));
+ base::Bind(&LocalFileSyncContext::ClearChangesForURL, this,
+ base::RetainedRef(file_system_context), url, done_callback));
return;
}
@@ -160,10 +156,9 @@ void LocalFileSyncContext::FinalizeSnapshotSync(
if (!file_system_context->default_file_task_runner()->
RunsTasksOnCurrentThread()) {
file_system_context->default_file_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::FinalizeSnapshotSync,
- this, make_scoped_refptr(file_system_context),
- url, sync_finish_status, done_callback));
+ FROM_HERE, base::Bind(&LocalFileSyncContext::FinalizeSnapshotSync, this,
+ base::RetainedRef(file_system_context), url,
+ sync_finish_status, done_callback));
return;
}
@@ -205,7 +200,7 @@ void LocalFileSyncContext::FinalizeExclusiveSync(
if (clear_local_changes) {
ClearChangesForURL(file_system_context, url,
base::Bind(&LocalFileSyncContext::FinalizeExclusiveSync,
- this, make_scoped_refptr(file_system_context),
+ this, base::RetainedRef(file_system_context),
url, false, done_callback));
return;
}
@@ -227,10 +222,9 @@ void LocalFileSyncContext::PrepareForSync(
if (!io_task_runner_->RunsTasksOnCurrentThread()) {
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
io_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::PrepareForSync, this,
- make_scoped_refptr(file_system_context), url,
- sync_mode, callback));
+ FROM_HERE, base::Bind(&LocalFileSyncContext::PrepareForSync, this,
+ base::RetainedRef(file_system_context), url,
+ sync_mode, callback));
return;
}
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
@@ -239,12 +233,10 @@ void LocalFileSyncContext::PrepareForSync(
if (syncable)
sync_status()->StartSyncing(url);
ui_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::DidGetWritingStatusForSync,
- this, make_scoped_refptr(file_system_context),
- syncable ? SYNC_STATUS_OK :
- SYNC_STATUS_FILE_BUSY,
- url, sync_mode, callback));
+ FROM_HERE, base::Bind(&LocalFileSyncContext::DidGetWritingStatusForSync,
+ this, base::RetainedRef(file_system_context),
+ syncable ? SYNC_STATUS_OK : SYNC_STATUS_FILE_BUSY,
+ url, sync_mode, callback));
}
void LocalFileSyncContext::RegisterURLForWaitingSync(
@@ -280,10 +272,9 @@ void LocalFileSyncContext::ApplyRemoteChange(
if (!io_task_runner_->RunsTasksOnCurrentThread()) {
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
io_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::ApplyRemoteChange, this,
- make_scoped_refptr(file_system_context),
- change, local_path, url, callback));
+ FROM_HERE, base::Bind(&LocalFileSyncContext::ApplyRemoteChange, this,
+ base::RetainedRef(file_system_context), change,
+ local_path, url, callback));
return;
}
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
@@ -346,11 +337,7 @@ void LocalFileSyncContext::HandleRemoteAddOrUpdate(
url_for_sync, true /* recursive */,
base::Bind(
&LocalFileSyncContext::DidRemoveExistingEntryForRemoteAddOrUpdate,
- this,
- make_scoped_refptr(file_system_context),
- change,
- local_path,
- url,
+ this, base::RetainedRef(file_system_context), change, local_path, url,
callback));
}
@@ -394,14 +381,9 @@ void LocalFileSyncContext::DidRemoveExistingEntryForRemoteAddOrUpdate(
url_for_sync.mount_type(),
storage::VirtualPath::DirName(url_for_sync.virtual_path()));
file_system_context->operation_runner()->CreateDirectory(
- dir_url,
- false /* exclusive */,
- true /* recursive */,
- base::Bind(&LocalFileSyncContext::DidCreateDirectoryForCopyIn,
- this,
- make_scoped_refptr(file_system_context),
- local_path,
- url,
+ dir_url, false /* exclusive */, true /* recursive */,
+ base::Bind(&LocalFileSyncContext::DidCreateDirectoryForCopyIn, this,
+ base::RetainedRef(file_system_context), local_path, url,
operation_callback));
}
break;
@@ -427,10 +409,9 @@ void LocalFileSyncContext::RecordFakeLocalChange(
RunsTasksOnCurrentThread()) {
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
file_system_context->default_file_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::RecordFakeLocalChange,
- this, make_scoped_refptr(file_system_context),
- url, change, callback));
+ FROM_HERE, base::Bind(&LocalFileSyncContext::RecordFakeLocalChange,
+ this, base::RetainedRef(file_system_context), url,
+ change, callback));
return;
}
@@ -457,7 +438,7 @@ void LocalFileSyncContext::GetFileMetadata(
io_task_runner_->PostTask(
FROM_HERE,
base::Bind(&LocalFileSyncContext::GetFileMetadata, this,
- make_scoped_refptr(file_system_context), url, callback));
+ base::RetainedRef(file_system_context), url, callback));
return;
}
DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
@@ -482,9 +463,8 @@ void LocalFileSyncContext::HasPendingLocalChanges(
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
file_system_context->default_file_task_runner()->PostTask(
FROM_HERE,
- base::Bind(&LocalFileSyncContext::HasPendingLocalChanges,
- this, make_scoped_refptr(file_system_context),
- url, callback));
+ base::Bind(&LocalFileSyncContext::HasPendingLocalChanges, this,
+ base::RetainedRef(file_system_context), url, callback));
return;
}
@@ -513,9 +493,8 @@ void LocalFileSyncContext::PromoteDemotedChanges(
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
file_system_context->default_file_task_runner()->PostTask(
FROM_HERE,
- base::Bind(&LocalFileSyncContext::PromoteDemotedChanges,
- this, origin, make_scoped_refptr(file_system_context),
- callback));
+ base::Bind(&LocalFileSyncContext::PromoteDemotedChanges, this, origin,
+ base::RetainedRef(file_system_context), callback));
return;
}
@@ -665,16 +644,13 @@ void LocalFileSyncContext::InitializeFileSystemContextOnIOThread(
scoped_ptr<LocalFileChangeTracker>* tracker_ptr(
new scoped_ptr<LocalFileChangeTracker>);
base::PostTaskAndReplyWithResult(
- file_system_context->default_file_task_runner(),
- FROM_HERE,
+ file_system_context->default_file_task_runner(), FROM_HERE,
base::Bind(&LocalFileSyncContext::InitializeChangeTrackerOnFileThread,
- this, tracker_ptr,
- make_scoped_refptr(file_system_context),
+ this, tracker_ptr, base::RetainedRef(file_system_context),
origins_with_changes),
base::Bind(&LocalFileSyncContext::DidInitializeChangeTrackerOnIOThread,
- this, base::Owned(tracker_ptr),
- source_url,
- make_scoped_refptr(file_system_context),
+ this, base::Owned(tracker_ptr), source_url,
+ base::RetainedRef(file_system_context),
base::Owned(origins_with_changes)));
return;
}
@@ -759,9 +735,8 @@ void LocalFileSyncContext::DidInitialize(
if (!ui_task_runner_->RunsTasksOnCurrentThread()) {
ui_task_runner_->PostTask(
FROM_HERE,
- base::Bind(&LocalFileSyncContext::DidInitialize,
- this, source_url,
- make_scoped_refptr(file_system_context), status));
+ base::Bind(&LocalFileSyncContext::DidInitialize, this, source_url,
+ base::RetainedRef(file_system_context), status));
return;
}
DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
@@ -826,11 +801,10 @@ void LocalFileSyncContext::TryPrepareForLocalSync(
const FileSystemURL url = urls->front();
urls->pop_front();
- PrepareForSync(
- file_system_context, url, SYNC_SNAPSHOT,
- base::Bind(&LocalFileSyncContext::DidTryPrepareForLocalSync,
- this, make_scoped_refptr(file_system_context),
- base::Passed(&urls), callback));
+ PrepareForSync(file_system_context, url, SYNC_SNAPSHOT,
+ base::Bind(&LocalFileSyncContext::DidTryPrepareForLocalSync,
+ this, base::RetainedRef(file_system_context),
+ base::Passed(&urls), callback));
}
void LocalFileSyncContext::DidTryPrepareForLocalSync(
@@ -866,8 +840,8 @@ void LocalFileSyncContext::PromoteDemotedChangesForURL(
return;
file_system_context->default_file_task_runner()->PostTask(
FROM_HERE,
- base::Bind(&LocalFileSyncContext::PromoteDemotedChangesForURL,
- this, make_scoped_refptr(file_system_context), url));
+ base::Bind(&LocalFileSyncContext::PromoteDemotedChangesForURL, this,
+ base::RetainedRef(file_system_context), url));
return;
}
@@ -889,8 +863,8 @@ void LocalFileSyncContext::PromoteDemotedChangesForURLs(
return;
file_system_context->default_file_task_runner()->PostTask(
FROM_HERE,
- base::Bind(&LocalFileSyncContext::PromoteDemotedChangesForURLs,
- this, make_scoped_refptr(file_system_context),
+ base::Bind(&LocalFileSyncContext::PromoteDemotedChangesForURLs, this,
+ base::RetainedRef(file_system_context),
base::Passed(&urls)));
return;
}
@@ -917,10 +891,9 @@ void LocalFileSyncContext::DidGetWritingStatusForSync(
return;
}
file_system_context->default_file_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&LocalFileSyncContext::DidGetWritingStatusForSync,
- this, make_scoped_refptr(file_system_context),
- status, url, sync_mode, callback));
+ FROM_HERE, base::Bind(&LocalFileSyncContext::DidGetWritingStatusForSync,
+ this, base::RetainedRef(file_system_context),
+ status, url, sync_mode, callback));
return;
}
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
index e09596e..73cd0df 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_context_unittest.cc
@@ -160,7 +160,7 @@ class LocalFileSyncContextTest : public testing::Test {
file_system_context, change, local_path, url,
base::Bind(&LocalFileSyncContextTest::DidApplyRemoteChange,
base::Unretained(this),
- make_scoped_refptr(file_system_context), url));
+ base::RetainedRef(file_system_context), url));
base::MessageLoop::current()->Run();
return status_;
}
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service.cc b/chrome/browser/sync_file_system/local/local_file_sync_service.cc
index d9904fb..c2d9778 100644
--- a/chrome/browser/sync_file_system/local/local_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/local/local_file_sync_service.cc
@@ -138,7 +138,7 @@ void LocalFileSyncService::MaybeInitializeFileSystemContext(
app_origin, file_system_context,
base::Bind(&LocalFileSyncService::DidInitializeFileSystemContext,
AsWeakPtr(), app_origin,
- make_scoped_refptr(file_system_context), callback));
+ base::RetainedRef(file_system_context), callback));
}
void LocalFileSyncService::AddChangeObserver(Observer* observer) {
@@ -251,12 +251,9 @@ void LocalFileSyncService::PrepareForProcessRemoteChange(
content::BrowserContext::GetStoragePartitionForSite(profile_, site_url)
->GetFileSystemContext();
MaybeInitializeFileSystemContext(
- url.origin(),
- file_system_context.get(),
+ url.origin(), file_system_context.get(),
base::Bind(&LocalFileSyncService::DidInitializeForRemoteSync,
- AsWeakPtr(),
- url,
- file_system_context,
+ AsWeakPtr(), url, base::RetainedRef(file_system_context),
callback));
return;
}
diff --git a/chrome/browser/sync_file_system/local/root_delete_helper.cc b/chrome/browser/sync_file_system/local/root_delete_helper.cc
index 63a9000..ff36cef 100644
--- a/chrome/browser/sync_file_system/local/root_delete_helper.cc
+++ b/chrome/browser/sync_file_system/local/root_delete_helper.cc
@@ -76,8 +76,8 @@ void RootDeleteHelper::DidDeleteFileSystem(base::File::Error error) {
// TODO(kinuko): This should be probably automatically handled in
// DeleteFileSystem via QuotaUtil::DeleteOriginDataOnFileThread.
file_system_context_->default_file_task_runner()->PostTaskAndReply(
- FROM_HERE,
- base::Bind(&ResetFileChangeTracker, file_system_context_, url_),
+ FROM_HERE, base::Bind(&ResetFileChangeTracker,
+ base::RetainedRef(file_system_context_), url_),
base::Bind(&RootDeleteHelper::DidResetFileChangeTracker,
weak_factory_.GetWeakPtr()));
}
diff --git a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
index cd67ac1..febf9f1 100644
--- a/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
+++ b/chrome/browser/sync_file_system/local/sync_file_system_backend.cc
@@ -127,12 +127,8 @@ void SyncFileSystemBackend::ResolveURL(const storage::FileSystemURL& url,
// It is safe to pass Unretained(this) since |context_| owns it.
SyncStatusCallback initialize_callback =
base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService,
- base::Unretained(this),
- make_scoped_refptr(context_),
- url.origin(),
- url.type(),
- mode,
- callback);
+ base::Unretained(this), base::RetainedRef(context_),
+ url.origin(), url.type(), mode, callback);
InitializeSyncFileSystemService(url.origin(), initialize_callback);
}
@@ -305,7 +301,7 @@ void SyncFileSystemBackend::DidInitializeSyncFileSystemService(
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService,
- base::Unretained(this), make_scoped_refptr(context),
+ base::Unretained(this), base::RetainedRef(context),
origin_url, type, mode, callback, status));
return;
}