| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 // A class that watches the syncer and attempts to resolve any conflicts that | 5 // A class that watches the syncer and attempts to resolve any conflicts that |
| 6 // occur. | 6 // occur. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 8 #ifndef CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
| 9 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 9 #define CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
| 10 | 10 |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/gtest_prod_util.h" |
| 15 #include "chrome/browser/sync/engine/syncer_types.h" | 16 #include "chrome/browser/sync/engine/syncer_types.h" |
| 16 #include "chrome/common/deprecated/event_sys.h" | 17 #include "chrome/common/deprecated/event_sys.h" |
| 17 #include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST | |
| 18 | 18 |
| 19 namespace syncable { | 19 namespace syncable { |
| 20 class BaseTransaction; | 20 class BaseTransaction; |
| 21 class Id; | 21 class Id; |
| 22 class MutableEntry; | 22 class MutableEntry; |
| 23 class ScopedDirLookup; | 23 class ScopedDirLookup; |
| 24 class WriteTransaction; | 24 class WriteTransaction; |
| 25 } // namespace syncable | 25 } // namespace syncable |
| 26 | 26 |
| 27 namespace browser_sync { | 27 namespace browser_sync { |
| 28 namespace sessions { | 28 namespace sessions { |
| 29 class StatusController; | 29 class StatusController; |
| 30 } | 30 } |
| 31 | 31 |
| 32 class ConflictResolver { | 32 class ConflictResolver { |
| 33 friend class SyncerTest; | 33 friend class SyncerTest; |
| 34 FRIEND_TEST(SyncerTest, ConflictResolverMergeOverwritesLocalEntry); | 34 FRIEND_TEST_ALL_PREFIXES(SyncerTest, |
| 35 ConflictResolverMergeOverwritesLocalEntry); |
| 35 public: | 36 public: |
| 36 ConflictResolver(); | 37 ConflictResolver(); |
| 37 ~ConflictResolver(); | 38 ~ConflictResolver(); |
| 38 // Called by the syncer at the end of a update/commit cycle. | 39 // Called by the syncer at the end of a update/commit cycle. |
| 39 // Returns true if the syncer should try to apply its updates again. | 40 // Returns true if the syncer should try to apply its updates again. |
| 40 bool ResolveConflicts(const syncable::ScopedDirLookup& dir, | 41 bool ResolveConflicts(const syncable::ScopedDirLookup& dir, |
| 41 sessions::StatusController* status); | 42 sessions::StatusController* status); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 // We keep a map to record how often we've seen each conflict set. We use this | 45 // We keep a map to record how often we've seen each conflict set. We use this |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // deep trees. Used to happen in store refresh. | 89 // deep trees. Used to happen in store refresh. |
| 89 // TODO(chron): Can we get rid of this optimization? | 90 // TODO(chron): Can we get rid of this optimization? |
| 90 std::set<syncable::Id> children_of_merged_dirs_; | 91 std::set<syncable::Id> children_of_merged_dirs_; |
| 91 | 92 |
| 92 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); | 93 DISALLOW_COPY_AND_ASSIGN(ConflictResolver); |
| 93 }; | 94 }; |
| 94 | 95 |
| 95 } // namespace browser_sync | 96 } // namespace browser_sync |
| 96 | 97 |
| 97 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ | 98 #endif // CHROME_BROWSER_SYNC_ENGINE_CONFLICT_RESOLVER_H_ |
| OLD | NEW |