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 COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_ |
6 #define SYNC_ENGINE_SYNCER_H_ | 6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "sync/base/sync_export.h" | 17 #include "components/sync/base/extensions_activity.h" |
18 #include "sync/engine/conflict_resolver.h" | 18 #include "components/sync/base/model_type.h" |
19 #include "sync/engine/syncer_types.h" | 19 #include "components/sync/base/sync_export.h" |
20 #include "sync/internal_api/public/base/model_type.h" | 20 #include "components/sync/engine_impl/conflict_resolver.h" |
21 #include "sync/sessions/sync_session.h" | 21 #include "components/sync/engine_impl/syncer_types.h" |
22 #include "sync/util/extensions_activity.h" | 22 #include "components/sync/sessions_impl/sync_session.h" |
23 | 23 |
24 namespace syncer { | 24 namespace syncer { |
25 | 25 |
26 class CancelationSignal; | 26 class CancelationSignal; |
27 class CommitProcessor; | 27 class CommitProcessor; |
28 class GetUpdatesProcessor; | 28 class GetUpdatesProcessor; |
29 | 29 |
30 // A Syncer provides a control interface for driving the sync cycle. These | 30 // A Syncer provides a control interface for driving the sync cycle. These |
31 // cycles consist of downloading updates, parsing the response (aka. process | 31 // cycles consist of downloading updates, parsing the response (aka. process |
32 // updates), applying updates while resolving conflicts, and committing local | 32 // updates), applying updates while resolving conflicts, and committing local |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 FRIEND_TEST_ALL_PREFIXES(SyncerTest, UnappliedUpdateDuringCommit); | 101 FRIEND_TEST_ALL_PREFIXES(SyncerTest, UnappliedUpdateDuringCommit); |
102 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryInFolder); | 102 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryInFolder); |
103 FRIEND_TEST_ALL_PREFIXES(SyncerTest, | 103 FRIEND_TEST_ALL_PREFIXES(SyncerTest, |
104 LongChangelistCreatesFakeOrphanedEntries); | 104 LongChangelistCreatesFakeOrphanedEntries); |
105 FRIEND_TEST_ALL_PREFIXES(SyncerTest, QuicklyMergeDualCreatedHierarchy); | 105 FRIEND_TEST_ALL_PREFIXES(SyncerTest, QuicklyMergeDualCreatedHierarchy); |
106 FRIEND_TEST_ALL_PREFIXES(SyncerTest, LongChangelistWithApplicationConflict); | 106 FRIEND_TEST_ALL_PREFIXES(SyncerTest, LongChangelistWithApplicationConflict); |
107 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryWithLocalEdits); | 107 FRIEND_TEST_ALL_PREFIXES(SyncerTest, DeletingEntryWithLocalEdits); |
108 FRIEND_TEST_ALL_PREFIXES(EntryCreatedInNewFolderTest, | 108 FRIEND_TEST_ALL_PREFIXES(EntryCreatedInNewFolderTest, |
109 EntryCreatedInNewFolderMidSync); | 109 EntryCreatedInNewFolderMidSync); |
110 | 110 |
111 bool DownloadAndApplyUpdates( | 111 bool DownloadAndApplyUpdates(ModelTypeSet* request_types, |
112 ModelTypeSet* request_types, | 112 sessions::SyncSession* session, |
113 sessions::SyncSession* session, | 113 GetUpdatesProcessor* get_updates_processor, |
114 GetUpdatesProcessor* get_updates_processor, | 114 bool create_mobile_bookmarks_folder); |
115 bool create_mobile_bookmarks_folder); | |
116 | 115 |
117 // This function will commit batches of unsynced items to the server until the | 116 // This function will commit batches of unsynced items to the server until the |
118 // number of unsynced and ready to commit items reaches zero or an error is | 117 // number of unsynced and ready to commit items reaches zero or an error is |
119 // encountered. A request to exit early will be treated as an error and will | 118 // encountered. A request to exit early will be treated as an error and will |
120 // abort any blocking operations. | 119 // abort any blocking operations. |
121 SyncerError BuildAndPostCommits(ModelTypeSet request_types, | 120 SyncerError BuildAndPostCommits(ModelTypeSet request_types, |
122 sessions::NudgeTracker* nudge_tracker, | 121 sessions::NudgeTracker* nudge_tracker, |
123 sessions::SyncSession* session, | 122 sessions::SyncSession* session, |
124 CommitProcessor* commit_processor); | 123 CommitProcessor* commit_processor); |
125 | 124 |
126 void HandleCycleBegin(sessions::SyncSession* session); | 125 void HandleCycleBegin(sessions::SyncSession* session); |
127 bool HandleCycleEnd( | 126 bool HandleCycleEnd(sessions::SyncSession* session, |
128 sessions::SyncSession* session, | 127 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); |
129 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); | |
130 | 128 |
131 syncer::CancelationSignal* const cancelation_signal_; | 129 syncer::CancelationSignal* const cancelation_signal_; |
132 | 130 |
133 // Whether the syncer is in the middle of a sync attempt. | 131 // Whether the syncer is in the middle of a sync attempt. |
134 bool is_syncing_; | 132 bool is_syncing_; |
135 | 133 |
136 DISALLOW_COPY_AND_ASSIGN(Syncer); | 134 DISALLOW_COPY_AND_ASSIGN(Syncer); |
137 }; | 135 }; |
138 | 136 |
139 } // namespace syncer | 137 } // namespace syncer |
140 | 138 |
141 #endif // SYNC_ENGINE_SYNCER_H_ | 139 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_ |
OLD | NEW |