| Index: webkit/browser/fileapi/syncable/local_file_sync_context.cc
|
| diff --git a/webkit/browser/fileapi/syncable/local_file_sync_context.cc b/webkit/browser/fileapi/syncable/local_file_sync_context.cc
|
| index 764eb4286291caf2749b13d7d2f0430869b04499..9708407ade28656613dbd9de815c74ec70fcb95e 100644
|
| --- a/webkit/browser/fileapi/syncable/local_file_sync_context.cc
|
| +++ b/webkit/browser/fileapi/syncable/local_file_sync_context.cc
|
| @@ -19,6 +19,7 @@
|
| #include "webkit/browser/fileapi/syncable/local_file_change_tracker.h"
|
| #include "webkit/browser/fileapi/syncable/local_origin_change_observer.h"
|
| #include "webkit/browser/fileapi/syncable/sync_file_metadata.h"
|
| +#include "webkit/browser/fileapi/syncable/sync_file_system_backend.h"
|
| #include "webkit/browser/fileapi/syncable/syncable_file_operation_runner.h"
|
| #include "webkit/browser/fileapi/syncable/syncable_file_system_util.h"
|
| #include "webkit/common/fileapi/file_system_util.h"
|
| @@ -119,8 +120,12 @@ void LocalFileSyncContext::ClearChangesForURL(
|
| url, done_callback));
|
| return;
|
| }
|
| - DCHECK(file_system_context->change_tracker());
|
| - file_system_context->change_tracker()->ClearChangesForURL(url);
|
| +
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + DCHECK(backend->change_tracker());
|
| + backend->change_tracker()->ClearChangesForURL(url);
|
|
|
| // Call the completion callback on UI thread.
|
| ui_task_runner_->PostTask(FROM_HERE, done_callback);
|
| @@ -303,9 +308,12 @@ void LocalFileSyncContext::RecordFakeLocalChange(
|
| return;
|
| }
|
|
|
| - DCHECK(file_system_context->change_tracker());
|
| - file_system_context->change_tracker()->MarkDirtyOnDatabase(url);
|
| - file_system_context->change_tracker()->RecordChange(url, change);
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + DCHECK(backend->change_tracker());
|
| + backend->change_tracker()->MarkDirtyOnDatabase(url);
|
| + backend->change_tracker()->RecordChange(url, change);
|
|
|
| // Fire the callback on UI thread.
|
| ui_task_runner_->PostTask(FROM_HERE,
|
| @@ -352,9 +360,12 @@ void LocalFileSyncContext::HasPendingLocalChanges(
|
| return;
|
| }
|
|
|
| - DCHECK(file_system_context->change_tracker());
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + DCHECK(backend->change_tracker());
|
| FileChangeList changes;
|
| - file_system_context->change_tracker()->GetChangesForURL(url, &changes);
|
| + backend->change_tracker()->GetChangesForURL(url, &changes);
|
|
|
| // Fire the callback on UI thread.
|
| ui_task_runner_->PostTask(FROM_HERE,
|
| @@ -446,7 +457,10 @@ void LocalFileSyncContext::InitializeFileSystemContextOnIOThread(
|
| FileSystemContext* file_system_context) {
|
| DCHECK(io_task_runner_->RunsTasksOnCurrentThread());
|
| DCHECK(file_system_context);
|
| - if (!file_system_context->change_tracker()) {
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + if (!backend->change_tracker()) {
|
| // First registers the service name.
|
| RegisterSyncableFileSystem();
|
| // Create and initialize LocalFileChangeTracker and call back this method
|
| @@ -478,7 +492,7 @@ void LocalFileSyncContext::InitializeFileSystemContextOnIOThread(
|
| sync_status_.get()));
|
| sync_status_->AddObserver(this);
|
| }
|
| - file_system_context->set_sync_context(this);
|
| + backend->set_sync_context(this);
|
| DidInitialize(source_url, file_system_context,
|
| SYNC_STATUS_OK);
|
| }
|
| @@ -520,7 +534,11 @@ void LocalFileSyncContext::DidInitializeChangeTrackerOnIOThread(
|
| DidInitialize(source_url, file_system_context, status);
|
| return;
|
| }
|
| - file_system_context->SetLocalFileChangeTracker(tracker_ptr->Pass());
|
| +
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + backend->set_change_tracker(tracker_ptr->Pass());
|
|
|
| origins_with_pending_changes_.insert(origins_with_changes->begin(),
|
| origins_with_changes->end());
|
| @@ -544,7 +562,12 @@ void LocalFileSyncContext::DidInitialize(
|
| DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
|
| DCHECK(!ContainsKey(file_system_contexts_, file_system_context));
|
| DCHECK(ContainsKey(pending_initialize_callbacks_, file_system_context));
|
| - DCHECK(file_system_context->change_tracker());
|
| +
|
| +
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + DCHECK(backend->change_tracker());
|
|
|
| file_system_contexts_.insert(file_system_context);
|
|
|
| @@ -563,8 +586,12 @@ void LocalFileSyncContext::GetNextURLsForSyncOnFileThread(
|
| DCHECK(file_system_context);
|
| DCHECK(file_system_context->task_runners()->file_task_runner()->
|
| RunsTasksOnCurrentThread());
|
| - DCHECK(file_system_context->change_tracker());
|
| - file_system_context->change_tracker()->GetNextChangedURLs(
|
| +
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + DCHECK(backend->change_tracker());
|
| + backend->change_tracker()->GetNextChangedURLs(
|
| urls, kMaxURLsToFetchForLocalSync);
|
| }
|
|
|
| @@ -635,9 +662,12 @@ void LocalFileSyncContext::DidGetWritingStatusForSync(
|
| return;
|
| }
|
|
|
| - DCHECK(file_system_context->change_tracker());
|
| + SyncFileSystemBackend* backend =
|
| + SyncFileSystemBackend::GetBackend(file_system_context);
|
| + DCHECK(backend);
|
| + DCHECK(backend->change_tracker());
|
| FileChangeList changes;
|
| - file_system_context->change_tracker()->GetChangesForURL(url, &changes);
|
| + backend->change_tracker()->GetChangesForURL(url, &changes);
|
|
|
| base::FilePath platform_path;
|
| base::PlatformFileInfo file_info;
|
|
|