Chromium Code Reviews| 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/apply_updates_command.h" | 5 #include "sync/engine/apply_updates_command.h" |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "sync/engine/update_applicator.h" | 8 #include "sync/engine/update_applicator.h" |
| 9 #include "sync/sessions/sync_session.h" | 9 #include "sync/sessions/sync_session.h" |
| 10 #include "sync/syncable/directory.h" | 10 #include "sync/syncable/directory.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 dir->GetServerTypesWithUnappliedUpdates(&trans); | 50 dir->GetServerTypesWithUnappliedUpdates(&trans); |
| 51 FullModelTypeSet server_type_restriction; | 51 FullModelTypeSet server_type_restriction; |
| 52 for (FullModelTypeSet::Iterator it = | 52 for (FullModelTypeSet::Iterator it = |
| 53 server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { | 53 server_types_with_unapplied_updates.First(); it.Good(); it.Inc()) { |
| 54 if (GetGroupForModelType(it.Get(), session->routing_info()) == | 54 if (GetGroupForModelType(it.Get(), session->routing_info()) == |
| 55 session->status_controller().group_restriction()) { | 55 session->status_controller().group_restriction()) { |
| 56 server_type_restriction.Put(it.Get()); | 56 server_type_restriction.Put(it.Get()); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Don't process control type updates here. They will be handled elsewhere. | |
| 61 ModelTypeSet control_types = ControlTypes(); | |
| 62 for (ModelTypeSet::Iterator i = control_types.First(); i.Good(); i.Inc()) { | |
| 63 server_type_restriction.Remove(i.Get()); | |
|
tim (not reviewing)
2012/08/30 20:18:33
This would be nicer to read as a single line 'Remo
rlarocque
2012/08/30 21:01:48
I feel the same way. I'd like to enforce that we
tim (not reviewing)
2012/08/30 21:41:04
I was really thinking low key, like
full_set.Diff
| |
| 64 } | |
| 65 | |
| 60 std::vector<int64> handles; | 66 std::vector<int64> handles; |
| 61 dir->GetUnappliedUpdateMetaHandles( | 67 dir->GetUnappliedUpdateMetaHandles( |
| 62 &trans, server_type_restriction, &handles); | 68 &trans, server_type_restriction, &handles); |
| 63 | 69 |
| 64 UpdateApplicator applicator( | 70 UpdateApplicator applicator( |
| 65 session->context()->resolver(), | 71 session->context()->resolver(), |
| 66 dir->GetCryptographer(&trans), | 72 dir->GetCryptographer(&trans), |
| 67 handles.begin(), handles.end(), session->routing_info(), | 73 handles.begin(), handles.end(), session->routing_info(), |
| 68 session->status_controller().group_restriction()); | 74 session->status_controller().group_restriction()); |
| 69 while (applicator.AttemptOneApplication(&trans)) {} | 75 while (applicator.AttemptOneApplication(&trans)) {} |
| 70 applicator.SaveProgressIntoSessionState( | 76 applicator.SaveProgressIntoSessionState( |
| 71 session->mutable_status_controller()->mutable_conflict_progress(), | 77 session->mutable_status_controller()->mutable_conflict_progress(), |
| 72 session->mutable_status_controller()->mutable_update_progress()); | 78 session->mutable_status_controller()->mutable_update_progress()); |
| 73 | 79 |
| 74 // This might be the first time we've fully completed a sync cycle, for | 80 // This might be the first time we've fully completed a sync cycle, for |
| 75 // some subset of the currently synced datatypes. | 81 // some subset of the currently synced datatypes. |
| 76 const sessions::StatusController& status(session->status_controller()); | 82 const sessions::StatusController& status(session->status_controller()); |
| 77 if (status.ServerSaysNothingMoreToDownload()) { | 83 if (status.ServerSaysNothingMoreToDownload()) { |
| 78 for (ModelTypeSet::Iterator it = | 84 for (ModelTypeSet::Iterator it = |
| 79 status.updates_request_types().First(); it.Good(); it.Inc()) { | 85 status.updates_request_types().First(); it.Good(); it.Inc()) { |
| 80 // This gets persisted to the directory's backing store. | 86 // Don't set the flag for control types. We didn't process them here. |
| 81 dir->set_initial_sync_ended_for_type(it.Get(), true); | 87 if (!IsControlType(it.Get())) { |
|
tim (not reviewing)
2012/08/30 20:18:33
style nit - It's a bit less unintuitive treat the
tim (not reviewing)
2012/08/30 20:40:07
Heh, speaking of double negatives ... "it's a bit
rlarocque
2012/08/30 21:01:48
That's how I did it originally, but then I figured
| |
| 88 // This gets persisted to the directory's backing store. | |
| 89 dir->set_initial_sync_ended_for_type(it.Get(), true); | |
| 90 } | |
| 82 } | 91 } |
| 83 } | 92 } |
| 84 | 93 |
| 85 return SYNCER_OK; | 94 return SYNCER_OK; |
| 86 } | 95 } |
| 87 | 96 |
| 88 } // namespace syncer | 97 } // namespace syncer |
| OLD | NEW |