| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef SYNC_ENGINE_SYNCER_H_ | 5 #ifndef SYNC_ENGINE_SYNCER_H_ |
| 6 #define SYNC_ENGINE_SYNCER_H_ | 6 #define SYNC_ENGINE_SYNCER_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 14 #include "sync/engine/conflict_resolver.h" | 14 #include "sync/engine/conflict_resolver.h" |
| 15 #include "sync/engine/syncer_types.h" | 15 #include "sync/engine/syncer_types.h" |
| 16 #include "sync/internal_api/public/base/model_type.h" | 16 #include "sync/internal_api/public/base/model_type.h" |
| 17 #include "sync/sessions/sync_session.h" | 17 #include "sync/sessions/sync_session.h" |
| 18 #include "sync/util/extensions_activity_monitor.h" | 18 #include "sync/util/extensions_activity_monitor.h" |
| 19 | 19 |
| 20 namespace syncer { | 20 namespace syncer { |
| 21 | 21 |
| 22 namespace syncable { | 22 namespace syncable { |
| 23 class Entry; | 23 class Entry; |
| 24 class MutableEntry; | 24 class MutableEntry; |
| 25 } // namespace syncable | 25 } // namespace syncable |
| 26 | 26 |
| 27 enum SyncerStep { | 27 enum SyncerStep { |
| 28 SYNCER_BEGIN, | 28 SYNCER_BEGIN, |
| 29 DOWNLOAD_UPDATES, | 29 DOWNLOAD_UPDATES, |
| 30 PROCESS_CLIENT_COMMAND, | |
| 31 VERIFY_UPDATES, | 30 VERIFY_UPDATES, |
| 32 PROCESS_UPDATES, | 31 PROCESS_UPDATES, |
| 33 STORE_TIMESTAMPS, | 32 STORE_TIMESTAMPS, |
| 34 APPLY_UPDATES, | 33 APPLY_UPDATES, |
| 35 COMMIT, | 34 COMMIT, |
| 36 RESOLVE_CONFLICTS, | 35 RESOLVE_CONFLICTS, |
| 37 APPLY_UPDATES_TO_RESOLVE_CONFLICTS, | 36 APPLY_UPDATES_TO_RESOLVE_CONFLICTS, |
| 38 SYNCER_END | 37 SYNCER_END |
| 39 }; | 38 }; |
| 40 | 39 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 59 // and return early from SyncShare, if possible. | 58 // and return early from SyncShare, if possible. |
| 60 bool ExitRequested(); | 59 bool ExitRequested(); |
| 61 void RequestEarlyExit(); | 60 void RequestEarlyExit(); |
| 62 | 61 |
| 63 // Runs a sync cycle from |first_step| to |last_step|. | 62 // Runs a sync cycle from |first_step| to |last_step|. |
| 64 virtual void SyncShare(sessions::SyncSession* session, | 63 virtual void SyncShare(sessions::SyncSession* session, |
| 65 SyncerStep first_step, | 64 SyncerStep first_step, |
| 66 SyncerStep last_step); | 65 SyncerStep last_step); |
| 67 | 66 |
| 68 private: | 67 private: |
| 69 // Implements the PROCESS_CLIENT_COMMAND syncer step. | |
| 70 void ProcessClientCommand(sessions::SyncSession* session); | |
| 71 | |
| 72 bool early_exit_requested_; | 68 bool early_exit_requested_; |
| 73 base::Lock early_exit_requested_lock_; | 69 base::Lock early_exit_requested_lock_; |
| 74 | 70 |
| 75 ConflictResolver resolver_; | 71 ConflictResolver resolver_; |
| 76 | 72 |
| 77 friend class SyncerTest; | 73 friend class SyncerTest; |
| 78 FRIEND_TEST_ALL_PREFIXES(SyncerTest, NameClashWithResolver); | 74 FRIEND_TEST_ALL_PREFIXES(SyncerTest, NameClashWithResolver); |
| 79 FRIEND_TEST_ALL_PREFIXES(SyncerTest, IllegalAndLegalUpdates); | 75 FRIEND_TEST_ALL_PREFIXES(SyncerTest, IllegalAndLegalUpdates); |
| 80 FRIEND_TEST_ALL_PREFIXES(SyncerTest, TestCommitListOrderingAndNewParent); | 76 FRIEND_TEST_ALL_PREFIXES(SyncerTest, TestCommitListOrderingAndNewParent); |
| 81 FRIEND_TEST_ALL_PREFIXES(SyncerTest, | 77 FRIEND_TEST_ALL_PREFIXES(SyncerTest, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 100 }; | 96 }; |
| 101 | 97 |
| 102 // Utility function declarations. | 98 // Utility function declarations. |
| 103 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); | 99 void CopyServerFields(syncable::Entry* src, syncable::MutableEntry* dest); |
| 104 void ClearServerData(syncable::MutableEntry* entry); | 100 void ClearServerData(syncable::MutableEntry* entry); |
| 105 const char* SyncerStepToString(const SyncerStep); | 101 const char* SyncerStepToString(const SyncerStep); |
| 106 | 102 |
| 107 } // namespace syncer | 103 } // namespace syncer |
| 108 | 104 |
| 109 #endif // SYNC_ENGINE_SYNCER_H_ | 105 #endif // SYNC_ENGINE_SYNCER_H_ |
| OLD | NEW |