| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 5 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 SyncStatusCode status, | 125 SyncStatusCode status, |
| 126 const LocalFileSyncInfo& sync_file_info, | 126 const LocalFileSyncInfo& sync_file_info, |
| 127 storage::ScopedFile snapshot) { | 127 storage::ScopedFile snapshot) { |
| 128 ASSERT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread()); | 128 ASSERT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread()); |
| 129 has_inflight_prepare_for_sync_ = false; | 129 has_inflight_prepare_for_sync_ = false; |
| 130 status_ = status; | 130 status_ = status; |
| 131 *metadata_out = sync_file_info.metadata; | 131 *metadata_out = sync_file_info.metadata; |
| 132 *changes_out = sync_file_info.changes; | 132 *changes_out = sync_file_info.changes; |
| 133 if (snapshot_out) | 133 if (snapshot_out) |
| 134 *snapshot_out = snapshot.Pass(); | 134 *snapshot_out = snapshot.Pass(); |
| 135 base::MessageLoop::current()->Quit(); | 135 base::MessageLoop::current()->QuitWhenIdle(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 SyncStatusCode ApplyRemoteChange(FileSystemContext* file_system_context, | 138 SyncStatusCode ApplyRemoteChange(FileSystemContext* file_system_context, |
| 139 const FileChange& change, | 139 const FileChange& change, |
| 140 const base::FilePath& local_path, | 140 const base::FilePath& local_path, |
| 141 const FileSystemURL& url, | 141 const FileSystemURL& url, |
| 142 SyncFileType expected_file_type) { | 142 SyncFileType expected_file_type) { |
| 143 SCOPED_TRACE(testing::Message() << "ApplyChange for " << | 143 SCOPED_TRACE(testing::Message() << "ApplyChange for " << |
| 144 url.DebugString()); | 144 url.DebugString()); |
| 145 | 145 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 162 return status_; | 162 return status_; |
| 163 } | 163 } |
| 164 | 164 |
| 165 void DidApplyRemoteChange(FileSystemContext* file_system_context, | 165 void DidApplyRemoteChange(FileSystemContext* file_system_context, |
| 166 const FileSystemURL& url, | 166 const FileSystemURL& url, |
| 167 SyncStatusCode status) { | 167 SyncStatusCode status) { |
| 168 status_ = status; | 168 status_ = status; |
| 169 sync_context_->FinalizeExclusiveSync( | 169 sync_context_->FinalizeExclusiveSync( |
| 170 file_system_context, url, | 170 file_system_context, url, |
| 171 status == SYNC_STATUS_OK /* clear_local_changes */, | 171 status == SYNC_STATUS_OK /* clear_local_changes */, |
| 172 base::MessageLoop::QuitClosure()); | 172 base::MessageLoop::QuitWhenIdleClosure()); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void StartModifyFileOnIOThread(CannedSyncableFileSystem* file_system, | 175 void StartModifyFileOnIOThread(CannedSyncableFileSystem* file_system, |
| 176 const FileSystemURL& url) { | 176 const FileSystemURL& url) { |
| 177 ASSERT_TRUE(file_system != nullptr); | 177 ASSERT_TRUE(file_system != nullptr); |
| 178 if (!io_task_runner_->RunsTasksOnCurrentThread()) { | 178 if (!io_task_runner_->RunsTasksOnCurrentThread()) { |
| 179 async_modify_finished_ = false; | 179 async_modify_finished_ = false; |
| 180 ASSERT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread()); | 180 ASSERT_TRUE(ui_task_runner_->RunsTasksOnCurrentThread()); |
| 181 io_task_runner_->PostTask( | 181 io_task_runner_->PostTask( |
| 182 FROM_HERE, | 182 FROM_HERE, |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 | 950 |
| 951 // Make sure kDir and kFile are created by ApplyRemoteChange. | 951 // Make sure kDir and kFile are created by ApplyRemoteChange. |
| 952 EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile)); | 952 EXPECT_EQ(base::File::FILE_OK, file_system.FileExists(kFile)); |
| 953 EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir)); | 953 EXPECT_EQ(base::File::FILE_OK, file_system.DirectoryExists(kDir)); |
| 954 | 954 |
| 955 sync_context_->ShutdownOnUIThread(); | 955 sync_context_->ShutdownOnUIThread(); |
| 956 file_system.TearDown(); | 956 file_system.TearDown(); |
| 957 } | 957 } |
| 958 | 958 |
| 959 } // namespace sync_file_system | 959 } // namespace sync_file_system |
| OLD | NEW |