| 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/verify_updates_command.h" | 5 #include "sync/engine/verify_updates_command.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "sync/engine/syncer.h" | 10 #include "sync/engine/syncer.h" |
| 11 #include "sync/engine/syncer_proto_util.h" | 11 #include "sync/engine/syncer_proto_util.h" |
| 12 #include "sync/engine/syncer_types.h" | 12 #include "sync/engine/syncer_types.h" |
| 13 #include "sync/engine/syncer_util.h" | 13 #include "sync/engine/syncer_util.h" |
| 14 #include "sync/engine/syncproto.h" | 14 #include "sync/engine/syncproto.h" |
| 15 #include "sync/internal_api/public/engine/model_safe_worker.h" | 15 #include "sync/internal_api/public/engine/model_safe_worker.h" |
| 16 #include "sync/protocol/bookmark_specifics.pb.h" | 16 #include "sync/protocol/bookmark_specifics.pb.h" |
| 17 #include "sync/syncable/entry.h" | 17 #include "sync/syncable/entry.h" |
| 18 #include "sync/syncable/mutable_entry.h" | 18 #include "sync/syncable/mutable_entry.h" |
| 19 #include "sync/syncable/write_transaction.h" | 19 #include "sync/syncable/write_transaction.h" |
| 20 | 20 |
| 21 namespace csync { | 21 namespace syncer { |
| 22 | 22 |
| 23 using syncable::GET_BY_ID; | 23 using syncable::GET_BY_ID; |
| 24 using syncable::ModelTypeSet; | 24 using syncable::ModelTypeSet; |
| 25 using syncable::SYNCER; | 25 using syncable::SYNCER; |
| 26 using syncable::WriteTransaction; | 26 using syncable::WriteTransaction; |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 // This function attempts to determine whether or not this update is genuinely | 30 // This function attempts to determine whether or not this update is genuinely |
| 31 // new, or if it is a reflection of one of our own commits. | 31 // new, or if it is a reflection of one of our own commits. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl( | 94 SyncerError VerifyUpdatesCommand::ModelChangingExecuteImpl( |
| 95 sessions::SyncSession* session) { | 95 sessions::SyncSession* session) { |
| 96 DVLOG(1) << "Beginning Update Verification"; | 96 DVLOG(1) << "Beginning Update Verification"; |
| 97 syncable::Directory* dir = session->context()->directory(); | 97 syncable::Directory* dir = session->context()->directory(); |
| 98 WriteTransaction trans(FROM_HERE, SYNCER, dir); | 98 WriteTransaction trans(FROM_HERE, SYNCER, dir); |
| 99 sessions::StatusController* status = session->mutable_status_controller(); | 99 sessions::StatusController* status = session->mutable_status_controller(); |
| 100 const GetUpdatesResponse& updates = status->updates_response().get_updates(); | 100 const GetUpdatesResponse& updates = status->updates_response().get_updates(); |
| 101 int update_count = updates.entries().size(); | 101 int update_count = updates.entries().size(); |
| 102 | 102 |
| 103 ModelTypeSet requested_types = csync::GetRoutingInfoTypes( | 103 ModelTypeSet requested_types = syncer::GetRoutingInfoTypes( |
| 104 session->routing_info()); | 104 session->routing_info()); |
| 105 | 105 |
| 106 DVLOG(1) << update_count << " entries to verify"; | 106 DVLOG(1) << update_count << " entries to verify"; |
| 107 for (int i = 0; i < update_count; i++) { | 107 for (int i = 0; i < update_count; i++) { |
| 108 const SyncEntity& update = | 108 const SyncEntity& update = |
| 109 *reinterpret_cast<const SyncEntity *>(&(updates.entries(i))); | 109 *reinterpret_cast<const SyncEntity *>(&(updates.entries(i))); |
| 110 ModelSafeGroup g = GetGroupForModelType(update.GetModelType(), | 110 ModelSafeGroup g = GetGroupForModelType(update.GetModelType(), |
| 111 session->routing_info()); | 111 session->routing_info()); |
| 112 if (g != status->group_restriction()) | 112 if (g != status->group_restriction()) |
| 113 continue; | 113 continue; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 result.value = SyncerUtil::VerifyUpdateConsistency(trans, entry, &same_id, | 179 result.value = SyncerUtil::VerifyUpdateConsistency(trans, entry, &same_id, |
| 180 deleted, is_directory, model_type); | 180 deleted, is_directory, model_type); |
| 181 } | 181 } |
| 182 | 182 |
| 183 if (VERIFY_UNDECIDED == result.value) | 183 if (VERIFY_UNDECIDED == result.value) |
| 184 result.value = VERIFY_SUCCESS; // No news is good news. | 184 result.value = VERIFY_SUCCESS; // No news is good news. |
| 185 | 185 |
| 186 return result; // This might be VERIFY_SUCCESS as well | 186 return result; // This might be VERIFY_SUCCESS as well |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace csync | 189 } // namespace syncer |
| OLD | NEW |