OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/engine/build_and_process_conflict_sets_command.h" | 5 #include "chrome/browser/sync/engine/build_and_process_conflict_sets_command.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <sstream> | 9 #include <sstream> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
| 14 #include "base/tracked.h" |
14 #include "chrome/browser/sync/engine/syncer_util.h" | 15 #include "chrome/browser/sync/engine/syncer_util.h" |
15 #include "chrome/browser/sync/engine/update_applicator.h" | 16 #include "chrome/browser/sync/engine/update_applicator.h" |
16 #include "chrome/browser/sync/sessions/sync_session.h" | 17 #include "chrome/browser/sync/sessions/sync_session.h" |
17 #include "chrome/browser/sync/syncable/directory_manager.h" | 18 #include "chrome/browser/sync/syncable/directory_manager.h" |
18 | 19 |
19 namespace browser_sync { | 20 namespace browser_sync { |
20 | 21 |
21 using sessions::ConflictProgress; | 22 using sessions::ConflictProgress; |
22 using sessions::StatusController; | 23 using sessions::StatusController; |
23 using sessions::SyncSession; | 24 using sessions::SyncSession; |
(...skipping 12 matching lines...) Expand all Loading... |
36 } | 37 } |
37 | 38 |
38 bool BuildAndProcessConflictSetsCommand::BuildAndProcessConflictSets( | 39 bool BuildAndProcessConflictSetsCommand::BuildAndProcessConflictSets( |
39 SyncSession* session) { | 40 SyncSession* session) { |
40 syncable::ScopedDirLookup dir(session->context()->directory_manager(), | 41 syncable::ScopedDirLookup dir(session->context()->directory_manager(), |
41 session->context()->account_name()); | 42 session->context()->account_name()); |
42 if (!dir.good()) | 43 if (!dir.good()) |
43 return false; | 44 return false; |
44 bool had_single_direction_sets = false; | 45 bool had_single_direction_sets = false; |
45 { // Scope for transaction. | 46 { // Scope for transaction. |
46 syncable::WriteTransaction trans(dir, syncable::SYNCER, __FILE__, __LINE__); | 47 syncable::WriteTransaction trans(dir, syncable::SYNCER, FROM_HERE); |
47 BuildConflictSets(&trans, | 48 BuildConflictSets(&trans, |
48 session->status_controller()->mutable_conflict_progress()); | 49 session->status_controller()->mutable_conflict_progress()); |
49 had_single_direction_sets = ProcessSingleDirectionConflictSets(&trans, | 50 had_single_direction_sets = ProcessSingleDirectionConflictSets(&trans, |
50 session->context()->resolver(), | 51 session->context()->resolver(), |
51 session->context()->directory_manager()->GetCryptographer(&trans), | 52 session->context()->directory_manager()->GetCryptographer(&trans), |
52 session->status_controller(), session->routing_info()); | 53 session->status_controller(), session->routing_info()); |
53 // We applied some updates transactionally, lets try syncing again. | 54 // We applied some updates transactionally, lets try syncing again. |
54 if (had_single_direction_sets) | 55 if (had_single_direction_sets) |
55 return true; | 56 return true; |
56 } | 57 } |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 LocallyDeletedPathChecker checker; | 400 LocallyDeletedPathChecker checker; |
400 if (!checker.CausingConflict(parent, *entry)) | 401 if (!checker.CausingConflict(parent, *entry)) |
401 return; | 402 return; |
402 conflict_progress->MergeSets(entry->Get(syncable::ID), | 403 conflict_progress->MergeSets(entry->Get(syncable::ID), |
403 parent.Get(syncable::ID)); | 404 parent.Get(syncable::ID)); |
404 CrawlDeletedTreeMergingSets(trans, parent, conflict_progress, checker); | 405 CrawlDeletedTreeMergingSets(trans, parent, conflict_progress, checker); |
405 } | 406 } |
406 } | 407 } |
407 | 408 |
408 } // namespace browser_sync | 409 } // namespace browser_sync |
OLD | NEW |