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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return HandleCycleEnd(session, source); | 95 return HandleCycleEnd(session, source); |
96 } | 96 } |
97 | 97 |
98 bool Syncer::PollSyncShare(ModelTypeSet request_types, | 98 bool Syncer::PollSyncShare(ModelTypeSet request_types, |
99 SyncSession* session) { | 99 SyncSession* session) { |
100 HandleCycleBegin(session); | 100 HandleCycleBegin(session); |
101 VLOG(1) << "Polling types " << ModelTypeSetToString(request_types); | 101 VLOG(1) << "Polling types " << ModelTypeSetToString(request_types); |
102 DownloadAndApplyUpdates( | 102 DownloadAndApplyUpdates( |
103 request_types, | 103 request_types, |
104 session, | 104 session, |
105 base::Bind(&download::BuildDownloadUpdatesForPoll, | 105 base::Bind(&download::BuildSupplementDownloadUpdates, |
106 session, | 106 session, |
107 kCreateMobileBookmarksFolder, | 107 kCreateMobileBookmarksFolder, |
108 request_types)); | 108 request_types, |
| 109 sync_pb::SyncEnums::PERIODIC)); |
109 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::PERIODIC); | 110 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::PERIODIC); |
110 } | 111 } |
111 | 112 |
| 113 bool Syncer::RetrySyncShare(ModelTypeSet request_types, |
| 114 SyncSession* session) { |
| 115 HandleCycleBegin(session); |
| 116 VLOG(1) << "Retry types " << ModelTypeSetToString(request_types); |
| 117 DownloadAndApplyUpdates( |
| 118 request_types, |
| 119 session, |
| 120 base::Bind(&download::BuildSupplementDownloadUpdates, |
| 121 session, |
| 122 kCreateMobileBookmarksFolder, |
| 123 request_types, |
| 124 sync_pb::SyncEnums::RETRY)); |
| 125 return HandleCycleEnd(session, sync_pb::GetUpdatesCallerInfo::RETRY); |
| 126 } |
| 127 |
112 void Syncer::ApplyUpdates(SyncSession* session) { | 128 void Syncer::ApplyUpdates(SyncSession* session) { |
113 TRACE_EVENT0("sync", "ApplyUpdates"); | 129 TRACE_EVENT0("sync", "ApplyUpdates"); |
114 | 130 |
115 ApplyControlDataUpdates(session->context()->directory()); | 131 ApplyControlDataUpdates(session->context()->directory()); |
116 | 132 |
117 UpdateHandlerMap* handler_map = session->context()->update_handler_map(); | 133 UpdateHandlerMap* handler_map = session->context()->update_handler_map(); |
118 for (UpdateHandlerMap::iterator it = handler_map->begin(); | 134 for (UpdateHandlerMap::iterator it = handler_map->begin(); |
119 it != handler_map->end(); ++it) { | 135 it != handler_map->end(); ++it) { |
120 it->second->ApplyUpdates(session->mutable_status_controller()); | 136 it->second->ApplyUpdates(session->mutable_status_controller()); |
121 } | 137 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { | 210 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource source) { |
195 if (!ExitRequested()) { | 211 if (!ExitRequested()) { |
196 session->SendSyncCycleEndEventNotification(source); | 212 session->SendSyncCycleEndEventNotification(source); |
197 return true; | 213 return true; |
198 } else { | 214 } else { |
199 return false; | 215 return false; |
200 } | 216 } |
201 } | 217 } |
202 | 218 |
203 } // namespace syncer | 219 } // namespace syncer |
OLD | NEW |