OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/engine/syncer.h" | 5 #include "chrome/browser/sync/engine/syncer.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/tracked.h" | 9 #include "base/tracked.h" |
10 #include "chrome/browser/sync/engine/apply_updates_command.h" | 10 #include "chrome/browser/sync/engine/apply_updates_command.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 break; | 105 break; |
106 case CLEANUP_DISABLED_TYPES: { | 106 case CLEANUP_DISABLED_TYPES: { |
107 VLOG(1) << "Cleaning up disabled types"; | 107 VLOG(1) << "Cleaning up disabled types"; |
108 CleanupDisabledTypesCommand cleanup; | 108 CleanupDisabledTypesCommand cleanup; |
109 cleanup.Execute(session); | 109 cleanup.Execute(session); |
110 next_step = DOWNLOAD_UPDATES; | 110 next_step = DOWNLOAD_UPDATES; |
111 break; | 111 break; |
112 } | 112 } |
113 case DOWNLOAD_UPDATES: { | 113 case DOWNLOAD_UPDATES: { |
114 VLOG(1) << "Downloading Updates"; | 114 VLOG(1) << "Downloading Updates"; |
115 | |
116 // We would call set_syncing(false) at the SYNCER_END step. Note if | |
117 // we are on DOWNLOAD_UPDATES state we would not exit without | |
118 // going to SYNCER_END because of various cleanup steps. | |
119 session->status_controller()->set_syncing(true); | |
tim (not reviewing)
2011/08/09 19:57:47
Why are we making this change? What do you mean b
lipalani1
2011/08/09 20:36:48
hey even in that case we would always call syncer_
| |
115 DownloadUpdatesCommand download_updates; | 120 DownloadUpdatesCommand download_updates; |
116 download_updates.Execute(session); | 121 download_updates.Execute(session); |
117 next_step = PROCESS_CLIENT_COMMAND; | 122 next_step = PROCESS_CLIENT_COMMAND; |
118 break; | 123 break; |
119 } | 124 } |
120 case PROCESS_CLIENT_COMMAND: { | 125 case PROCESS_CLIENT_COMMAND: { |
121 VLOG(1) << "Processing Client Command"; | 126 VLOG(1) << "Processing Client Command"; |
122 ProcessClientCommand(session); | 127 ProcessClientCommand(session); |
123 next_step = VERIFY_UPDATES; | 128 next_step = VERIFY_UPDATES; |
124 break; | 129 break; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 last_step = SYNCER_END; | 166 last_step = SYNCER_END; |
162 next_step = SYNCER_END; | 167 next_step = SYNCER_END; |
163 } else { | 168 } else { |
164 next_step = BUILD_COMMIT_REQUEST; | 169 next_step = BUILD_COMMIT_REQUEST; |
165 } | 170 } |
166 break; | 171 break; |
167 } | 172 } |
168 // These two steps are combined since they are executed within the same | 173 // These two steps are combined since they are executed within the same |
169 // write transaction. | 174 // write transaction. |
170 case BUILD_COMMIT_REQUEST: { | 175 case BUILD_COMMIT_REQUEST: { |
171 session->status_controller()->set_syncing(true); | |
172 | |
173 VLOG(1) << "Processing Commit Request"; | 176 VLOG(1) << "Processing Commit Request"; |
174 ScopedDirLookup dir(session->context()->directory_manager(), | 177 ScopedDirLookup dir(session->context()->directory_manager(), |
175 session->context()->account_name()); | 178 session->context()->account_name()); |
176 if (!dir.good()) { | 179 if (!dir.good()) { |
177 LOG(ERROR) << "Scoped dir lookup failed!"; | 180 LOG(ERROR) << "Scoped dir lookup failed!"; |
178 return; | 181 return; |
179 } | 182 } |
180 WriteTransaction trans(FROM_HERE, SYNCER, dir); | 183 WriteTransaction trans(FROM_HERE, SYNCER, dir); |
181 sessions::ScopedSetSessionWriteTransaction set_trans(session, &trans); | 184 sessions::ScopedSetSessionWriteTransaction set_trans(session, &trans); |
182 | 185 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 entry->Put(SERVER_CTIME, 0); | 337 entry->Put(SERVER_CTIME, 0); |
335 entry->Put(SERVER_VERSION, 0); | 338 entry->Put(SERVER_VERSION, 0); |
336 entry->Put(SERVER_IS_DIR, false); | 339 entry->Put(SERVER_IS_DIR, false); |
337 entry->Put(SERVER_IS_DEL, false); | 340 entry->Put(SERVER_IS_DEL, false); |
338 entry->Put(IS_UNAPPLIED_UPDATE, false); | 341 entry->Put(IS_UNAPPLIED_UPDATE, false); |
339 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); | 342 entry->Put(SERVER_SPECIFICS, sync_pb::EntitySpecifics::default_instance()); |
340 entry->Put(SERVER_POSITION_IN_PARENT, 0); | 343 entry->Put(SERVER_POSITION_IN_PARENT, 0); |
341 } | 344 } |
342 | 345 |
343 } // namespace browser_sync | 346 } // namespace browser_sync |
OLD | NEW |