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

Side by Side Diff: components/sync/engine_impl/syncer.h

Issue 2850213002: [Sync] Minor refactor around SyncCycle and ModelTypeSet usage. (Closed)
Patch Set: Fix comment grammar. Created 3 years, 7 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
OLDNEW
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 COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_ 5 #ifndef COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_
6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_ 6 #define COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 SyncCycle* cycle); 51 SyncCycle* cycle);
52 52
53 // Performs an initial download for the |request_types|. It is assumed that 53 // Performs an initial download for the |request_types|. It is assumed that
54 // the specified types have no local state, and that their associated change 54 // the specified types have no local state, and that their associated change
55 // processors are in "passive" mode, so none of the downloaded updates will be 55 // processors are in "passive" mode, so none of the downloaded updates will be
56 // applied to the model. The |source| is sent up to the server for debug 56 // applied to the model. The |source| is sent up to the server for debug
57 // purposes. It describes the reson for performing this initial download. 57 // purposes. It describes the reson for performing this initial download.
58 // Returns: false if an error occurred and retries should backoff, true 58 // Returns: false if an error occurred and retries should backoff, true
59 // otherwise. 59 // otherwise.
60 virtual bool ConfigureSyncShare( 60 virtual bool ConfigureSyncShare(
61 ModelTypeSet request_types, 61 const ModelTypeSet& request_types,
62 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source, 62 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source,
63 SyncCycle* cycle); 63 SyncCycle* cycle);
64 64
65 // Requests to download updates for the |request_types|. For a well-behaved 65 // Requests to download updates for the |request_types|. For a well-behaved
66 // client with a working connection to the invalidations server, this should 66 // client with a working connection to the invalidations server, this should
67 // be unnecessary. It may be invoked periodically to try to keep the client 67 // be unnecessary. It may be invoked periodically to try to keep the client
68 // in sync despite bugs or transient failures. 68 // in sync despite bugs or transient failures.
69 // Returns: false if an error occurred and retries should backoff, true 69 // Returns: false if an error occurred and retries should backoff, true
70 // otherwise. 70 // otherwise.
71 virtual bool PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle); 71 virtual bool PollSyncShare(ModelTypeSet request_types, SyncCycle* cycle);
72 72
73 // Posts a ClearServerData command. 73 // Posts a ClearServerData command.
74 // Returns: false if an error occurred and retries should backoff, true 74 // Returns: false if an error occurred and retries should backoff, true
75 // otherwise. 75 // otherwise.
76 virtual bool PostClearServerData(SyncCycle* cycle); 76 virtual bool PostClearServerData(SyncCycle* cycle);
77 77
78 private: 78 private:
79 bool DownloadAndApplyUpdates(ModelTypeSet* request_types, 79 bool DownloadAndApplyUpdates(ModelTypeSet* request_types,
80 SyncCycle* cycle, 80 SyncCycle* cycle,
81 const GetUpdatesDelegate& delegate, 81 const GetUpdatesDelegate& delegate,
82 bool create_mobile_bookmarks_folder); 82 bool create_mobile_bookmarks_folder);
83 83
84 // This function will commit batches of unsynced items to the server until the 84 // This function will commit batches of unsynced items to the server until the
85 // number of unsynced and ready to commit items reaches zero or an error is 85 // number of unsynced and ready to commit items reaches zero or an error is
86 // encountered. A request to exit early will be treated as an error and will 86 // encountered. A request to exit early will be treated as an error and will
87 // abort any blocking operations. 87 // abort any blocking operations.
88 SyncerError BuildAndPostCommits(ModelTypeSet request_types, 88 SyncerError BuildAndPostCommits(const ModelTypeSet& request_types,
89 NudgeTracker* nudge_tracker, 89 NudgeTracker* nudge_tracker,
90 SyncCycle* cycle, 90 SyncCycle* cycle,
91 CommitProcessor* commit_processor); 91 CommitProcessor* commit_processor);
92 92
93 // Whether an early exist was requested due to a cancelation signal. 93 // Whether an early exist was requested due to a cancelation signal.
94 bool ExitRequested(); 94 bool ExitRequested();
95 95
96 bool HandleCycleEnd(SyncCycle* cycle, 96 bool HandleCycleEnd(SyncCycle* cycle,
97 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source); 97 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source);
98 98
99 CancelationSignal* const cancelation_signal_; 99 CancelationSignal* const cancelation_signal_;
100 100
101 // Whether the syncer is in the middle of a sync attempt. 101 // Whether the syncer is in the middle of a sync attempt.
102 bool is_syncing_; 102 bool is_syncing_;
103 103
104 DISALLOW_COPY_AND_ASSIGN(Syncer); 104 DISALLOW_COPY_AND_ASSIGN(Syncer);
105 }; 105 };
106 106
107 } // namespace syncer 107 } // namespace syncer
108 108
109 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_ 109 #endif // COMPONENTS_SYNC_ENGINE_IMPL_SYNCER_H_
OLDNEW
« no previous file with comments | « components/sync/engine_impl/sync_scheduler_impl_unittest.cc ('k') | components/sync/engine_impl/syncer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698