Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_change_tracker.cc

Issue 390283002: [SyncFS] Demote local file changes before local-to-remote sync (3/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: debug printfs Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698