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_change_tracker.h" | 5 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | |
9 #include <queue> | 8 #include <queue> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" | 16 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" |
17 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 17 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
18 #include "storage/browser/fileapi/file_system_context.h" | 18 #include "storage/browser/fileapi/file_system_context.h" |
19 #include "storage/browser/fileapi/file_system_file_util.h" | 19 #include "storage/browser/fileapi/file_system_file_util.h" |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 int change_seq = iter->second.change_seq; | 295 int change_seq = iter->second.change_seq; |
296 // Advance |iter| before calling ResetForURL to avoid the iterator | 296 // Advance |iter| before calling ResetForURL to avoid the iterator |
297 // invalidation in it. | 297 // invalidation in it. |
298 ++iter; | 298 ++iter; |
299 if (url.origin() == origin && url.type() == type) | 299 if (url.origin() == origin && url.type() == type) |
300 ResetForURL(url, change_seq, batch.get()); | 300 ResetForURL(url, change_seq, batch.get()); |
301 } | 301 } |
302 | 302 |
303 // Fail to apply batch to database wouldn't have critical effect, they'll be | 303 // Fail to apply batch to database wouldn't have critical effect, they'll be |
304 // just marked deleted on next relaunch. | 304 // just marked deleted on next relaunch. |
305 tracker_db_->WriteBatch(batch.Pass()); | 305 tracker_db_->WriteBatch(std::move(batch)); |
306 UpdateNumChanges(); | 306 UpdateNumChanges(); |
307 } | 307 } |
308 | 308 |
309 void LocalFileChangeTracker::UpdateNumChanges() { | 309 void LocalFileChangeTracker::UpdateNumChanges() { |
310 base::AutoLock lock(num_changes_lock_); | 310 base::AutoLock lock(num_changes_lock_); |
311 num_changes_ = static_cast<int64_t>(change_seqs_.size()); | 311 num_changes_ = static_cast<int64_t>(change_seqs_.size()); |
312 } | 312 } |
313 | 313 |
314 void LocalFileChangeTracker::GetAllChangedURLs(FileSystemURLSet* urls) { | 314 void LocalFileChangeTracker::GetAllChangedURLs(FileSystemURLSet* urls) { |
315 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); | 315 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 if (!status.ok() && !status.IsNotFound()) { | 617 if (!status.ok() && !status.IsNotFound()) { |
618 HandleError(FROM_HERE, status); | 618 HandleError(FROM_HERE, status); |
619 db_status_ = LevelDBStatusToSyncStatusCode(status); | 619 db_status_ = LevelDBStatusToSyncStatusCode(status); |
620 db_.reset(); | 620 db_.reset(); |
621 return db_status_; | 621 return db_status_; |
622 } | 622 } |
623 return SYNC_STATUS_OK; | 623 return SYNC_STATUS_OK; |
624 } | 624 } |
625 | 625 |
626 } // namespace sync_file_system | 626 } // namespace sync_file_system |
OLD | NEW |