| 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> |
| 8 |
| 7 #include <queue> | 9 #include <queue> |
| 8 | 10 |
| 9 #include "base/location.h" | 11 #include "base/location.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" |
| 11 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
| 12 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 13 #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" |
| 14 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 17 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 15 #include "storage/browser/fileapi/file_system_context.h" | 18 #include "storage/browser/fileapi/file_system_context.h" |
| 16 #include "storage/browser/fileapi/file_system_file_util.h" | 19 #include "storage/browser/fileapi/file_system_file_util.h" |
| 17 #include "storage/browser/fileapi/file_system_operation_context.h" | 20 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 18 #include "storage/common/fileapi/file_system_util.h" | 21 #include "storage/common/fileapi/file_system_util.h" |
| 19 #include "third_party/leveldatabase/env_chromium.h" | 22 #include "third_party/leveldatabase/env_chromium.h" |
| 20 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 23 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 301 } |
| 299 | 302 |
| 300 // 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 |
| 301 // just marked deleted on next relaunch. | 304 // just marked deleted on next relaunch. |
| 302 tracker_db_->WriteBatch(batch.Pass()); | 305 tracker_db_->WriteBatch(batch.Pass()); |
| 303 UpdateNumChanges(); | 306 UpdateNumChanges(); |
| 304 } | 307 } |
| 305 | 308 |
| 306 void LocalFileChangeTracker::UpdateNumChanges() { | 309 void LocalFileChangeTracker::UpdateNumChanges() { |
| 307 base::AutoLock lock(num_changes_lock_); | 310 base::AutoLock lock(num_changes_lock_); |
| 308 num_changes_ = static_cast<int64>(change_seqs_.size()); | 311 num_changes_ = static_cast<int64_t>(change_seqs_.size()); |
| 309 } | 312 } |
| 310 | 313 |
| 311 void LocalFileChangeTracker::GetAllChangedURLs(FileSystemURLSet* urls) { | 314 void LocalFileChangeTracker::GetAllChangedURLs(FileSystemURLSet* urls) { |
| 312 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); | 315 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); |
| 313 std::deque<FileSystemURL> url_deque; | 316 std::deque<FileSystemURL> url_deque; |
| 314 GetNextChangedURLs(&url_deque, 0); | 317 GetNextChangedURLs(&url_deque, 0); |
| 315 urls->clear(); | 318 urls->clear(); |
| 316 urls->insert(url_deque.begin(), url_deque.end()); | 319 urls->insert(url_deque.begin(), url_deque.end()); |
| 317 } | 320 } |
| 318 | 321 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 if (!status.ok() && !status.IsNotFound()) { | 617 if (!status.ok() && !status.IsNotFound()) { |
| 615 HandleError(FROM_HERE, status); | 618 HandleError(FROM_HERE, status); |
| 616 db_status_ = LevelDBStatusToSyncStatusCode(status); | 619 db_status_ = LevelDBStatusToSyncStatusCode(status); |
| 617 db_.reset(); | 620 db_.reset(); |
| 618 return db_status_; | 621 return db_status_; |
| 619 } | 622 } |
| 620 return SYNC_STATUS_OK; | 623 return SYNC_STATUS_OK; |
| 621 } | 624 } |
| 622 | 625 |
| 623 } // namespace sync_file_system | 626 } // namespace sync_file_system |
| OLD | NEW |