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 <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return; | 236 return; |
237 | 237 |
238 FileChangeList::List change_list = iter->second.change_list.list(); | 238 FileChangeList::List change_list = iter->second.change_list.list(); |
239 // Make sure that this URL is in no queues. | 239 // Make sure that this URL is in no queues. |
240 DCHECK(!ContainsKey(change_seqs_, iter->second.change_seq)); | 240 DCHECK(!ContainsKey(change_seqs_, iter->second.change_seq)); |
241 DCHECK(!ContainsKey(changes_, url)); | 241 DCHECK(!ContainsKey(changes_, url)); |
242 | 242 |
243 change_seqs_[iter->second.change_seq] = url; | 243 change_seqs_[iter->second.change_seq] = url; |
244 changes_.insert(*iter); | 244 changes_.insert(*iter); |
245 demoted_changes_.erase(iter); | 245 demoted_changes_.erase(iter); |
| 246 UpdateNumChanges(); |
246 } | 247 } |
247 | 248 |
248 bool LocalFileChangeTracker::PromoteDemotedChanges() { | 249 bool LocalFileChangeTracker::PromoteDemotedChanges() { |
249 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); | 250 DCHECK(file_task_runner_->RunsTasksOnCurrentThread()); |
250 if (demoted_changes_.empty()) | 251 if (demoted_changes_.empty()) |
251 return false; | 252 return false; |
252 while (!demoted_changes_.empty()) { | 253 while (!demoted_changes_.empty()) { |
253 fileapi::FileSystemURL url = demoted_changes_.begin()->first; | 254 fileapi::FileSystemURL url = demoted_changes_.begin()->first; |
254 PromoteDemotedChangesForURL(url); | 255 PromoteDemotedChangesForURL(url); |
255 } | 256 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 if (!status.ok() && !status.IsNotFound()) { | 608 if (!status.ok() && !status.IsNotFound()) { |
608 HandleError(FROM_HERE, status); | 609 HandleError(FROM_HERE, status); |
609 db_status_ = LevelDBStatusToSyncStatusCode(status); | 610 db_status_ = LevelDBStatusToSyncStatusCode(status); |
610 db_.reset(); | 611 db_.reset(); |
611 return db_status_; | 612 return db_status_; |
612 } | 613 } |
613 return SYNC_STATUS_OK; | 614 return SYNC_STATUS_OK; |
614 } | 615 } |
615 | 616 |
616 } // namespace sync_file_system | 617 } // namespace sync_file_system |
OLD | NEW |