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 #include "sync/engine/syncer.h" | 5 #include "sync/engine/syncer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 kCreateMobileBookmarksFolder, | 107 kCreateMobileBookmarksFolder, |
108 request_types)); | 108 request_types)); |
109 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::PERIODIC); | 109 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::PERIODIC); |
110 } | 110 } |
111 | 111 |
112 void Syncer::ApplyUpdates(SyncSession* session) { | 112 void Syncer::ApplyUpdates(SyncSession* session) { |
113 TRACE_EVENT0("sync", "ApplyUpdates"); | 113 TRACE_EVENT0("sync", "ApplyUpdates"); |
114 | 114 |
115 ApplyControlDataUpdates(session->context()->directory()); | 115 ApplyControlDataUpdates(session->context()->directory()); |
116 | 116 |
117 UpdateHandlerMap* handler_map = session->context()->update_handler_map(); | 117 session->context()->updater_list()->ApplyUpdatesForAllTypes( |
tim (not reviewing)
2014/01/08 19:33:42
:) I came to the conclusion that UpdaterList doesn
rlarocque
2014/01/09 00:31:18
That would make sense, but I think it makes more s
| |
118 for (UpdateHandlerMap::iterator it = handler_map->begin(); | 118 session->mutable_status_controller()); |
119 it != handler_map->end(); ++it) { | |
120 it->second->ApplyUpdates(session->mutable_status_controller()); | |
121 } | |
122 | 119 |
123 session->context()->set_hierarchy_conflict_detected( | 120 session->context()->set_hierarchy_conflict_detected( |
124 session->status_controller().num_hierarchy_conflicts() > 0); | 121 session->status_controller().num_hierarchy_conflicts() > 0); |
125 | 122 |
126 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED); | 123 session->SendEventNotification(SyncEngineEvent::STATUS_CHANGED); |
127 } | 124 } |
128 | 125 |
129 bool Syncer::DownloadAndApplyUpdates( | 126 bool Syncer::DownloadAndApplyUpdates( |
130 ModelTypeSet request_types, | 127 ModelTypeSet request_types, |
131 SyncSession* session, | 128 SyncSession* session, |
(...skipping 23 matching lines...) Expand all Loading... | |
155 | 152 |
156 SyncerError Syncer::BuildAndPostCommits(ModelTypeSet requested_types, | 153 SyncerError Syncer::BuildAndPostCommits(ModelTypeSet requested_types, |
157 sessions::SyncSession* session) { | 154 sessions::SyncSession* session) { |
158 // The ExitRequested() check is unnecessary, since we should start getting | 155 // The ExitRequested() check is unnecessary, since we should start getting |
159 // errors from the ServerConnectionManager if an exist has been requested. | 156 // errors from the ServerConnectionManager if an exist has been requested. |
160 // However, it doesn't hurt to check it anyway. | 157 // However, it doesn't hurt to check it anyway. |
161 while (!ExitRequested()) { | 158 while (!ExitRequested()) { |
162 scoped_ptr<Commit> commit( | 159 scoped_ptr<Commit> commit( |
163 Commit::Init( | 160 Commit::Init( |
164 requested_types, | 161 requested_types, |
162 session->context()->enabled_types(), | |
165 session->context()->max_commit_batch_size(), | 163 session->context()->max_commit_batch_size(), |
166 session->context()->account_name(), | 164 session->context()->account_name(), |
167 session->context()->directory()->cache_guid(), | 165 session->context()->directory()->cache_guid(), |
168 session->context()->commit_contributor_map(), | 166 session->context()->committer_list(), |
169 session->context()->extensions_activity())); | 167 session->context()->extensions_activity())); |
170 if (!commit) { | 168 if (!commit) { |
171 break; | 169 break; |
172 } | 170 } |
173 | 171 |
174 SyncerError error = commit->PostAndProcessResponse( | 172 SyncerError error = commit->PostAndProcessResponse( |
175 session, | 173 session, |
176 session->mutable_status_controller(), | 174 session->mutable_status_controller(), |
177 session->context()->extensions_activity()); | 175 session->context()->extensions_activity()); |
178 commit->CleanUp(); | 176 commit->CleanUp(); |
(...skipping 15 matching lines...) Expand all Loading... | |
194 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { | 192 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
195 if (!ExitRequested()) { | 193 if (!ExitRequested()) { |
196 session->SendSyncCycleEndEventNotification(source); | 194 session->SendSyncCycleEndEventNotification(source); |
197 return true; | 195 return true; |
198 } else { | 196 } else { |
199 return false; | 197 return false; |
200 } | 198 } |
201 } | 199 } |
202 | 200 |
203 } // namespace syncer | 201 } // namespace syncer |
OLD | NEW |