Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: sync/engine/process_updates_command.cc

Issue 10795018: [Sync] Remove unneeded 'using syncer::' lines and 'syncer::' scopings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fiix indent Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/process_updates_command.h" 5 #include "sync/engine/process_updates_command.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 namespace { 73 namespace {
74 // Returns true if the entry is still ok to process. 74 // Returns true if the entry is still ok to process.
75 bool ReverifyEntry(syncable::WriteTransaction* trans, 75 bool ReverifyEntry(syncable::WriteTransaction* trans,
76 const sync_pb::SyncEntity& entry, 76 const sync_pb::SyncEntity& entry,
77 syncable::MutableEntry* same_id) { 77 syncable::MutableEntry* same_id) {
78 78
79 const bool deleted = entry.has_deleted() && entry.deleted(); 79 const bool deleted = entry.has_deleted() && entry.deleted();
80 const bool is_directory = IsFolder(entry); 80 const bool is_directory = IsFolder(entry);
81 const syncer::ModelType model_type = GetModelType(entry); 81 const ModelType model_type = GetModelType(entry);
82 82
83 return VERIFY_SUCCESS == VerifyUpdateConsistency(trans, 83 return VERIFY_SUCCESS == VerifyUpdateConsistency(trans,
84 entry, 84 entry,
85 same_id, 85 same_id,
86 deleted, 86 deleted,
87 is_directory, 87 is_directory,
88 model_type); 88 model_type);
89 } 89 }
90 } // namespace 90 } // namespace
91 91
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 target_entry.Get(syncable::SERVER_PARENT_ID)) && 153 target_entry.Get(syncable::SERVER_PARENT_ID)) &&
154 (update.position_in_parent() == 154 (update.position_in_parent() ==
155 target_entry.Get(syncable::SERVER_POSITION_IN_PARENT)) && 155 target_entry.Get(syncable::SERVER_POSITION_IN_PARENT)) &&
156 update.has_specifics() && update.specifics().has_encrypted() && 156 update.has_specifics() && update.specifics().has_encrypted() &&
157 !cryptographer->CanDecrypt(update.specifics().encrypted())) { 157 !cryptographer->CanDecrypt(update.specifics().encrypted())) {
158 sync_pb::EntitySpecifics prev_specifics = 158 sync_pb::EntitySpecifics prev_specifics =
159 target_entry.Get(syncable::SERVER_SPECIFICS); 159 target_entry.Get(syncable::SERVER_SPECIFICS);
160 // We only store the old specifics if they were decryptable and applied and 160 // We only store the old specifics if they were decryptable and applied and
161 // there is no BASE_SERVER_SPECIFICS already. Else do nothing. 161 // there is no BASE_SERVER_SPECIFICS already. Else do nothing.
162 if (!target_entry.Get(syncable::IS_UNAPPLIED_UPDATE) && 162 if (!target_entry.Get(syncable::IS_UNAPPLIED_UPDATE) &&
163 !syncer::IsRealDataType(syncer::GetModelTypeFromSpecifics( 163 !IsRealDataType(GetModelTypeFromSpecifics(
164 target_entry.Get(syncable::BASE_SERVER_SPECIFICS))) && 164 target_entry.Get(syncable::BASE_SERVER_SPECIFICS))) &&
165 (!prev_specifics.has_encrypted() || 165 (!prev_specifics.has_encrypted() ||
166 cryptographer->CanDecrypt(prev_specifics.encrypted()))) { 166 cryptographer->CanDecrypt(prev_specifics.encrypted()))) {
167 DVLOG(2) << "Storing previous server specifcs: " 167 DVLOG(2) << "Storing previous server specifcs: "
168 << prev_specifics.SerializeAsString(); 168 << prev_specifics.SerializeAsString();
169 target_entry.Put(syncable::BASE_SERVER_SPECIFICS, prev_specifics); 169 target_entry.Put(syncable::BASE_SERVER_SPECIFICS, prev_specifics);
170 } 170 }
171 } else if (syncer::IsRealDataType(syncer::GetModelTypeFromSpecifics( 171 } else if (IsRealDataType(GetModelTypeFromSpecifics(
172 target_entry.Get(syncable::BASE_SERVER_SPECIFICS)))) { 172 target_entry.Get(syncable::BASE_SERVER_SPECIFICS)))) {
173 // We have a BASE_SERVER_SPECIFICS, but a subsequent non-specifics-only 173 // We have a BASE_SERVER_SPECIFICS, but a subsequent non-specifics-only
174 // change arrived. As a result, we can't use the specifics alone to detect 174 // change arrived. As a result, we can't use the specifics alone to detect
175 // changes, so we clear BASE_SERVER_SPECIFICS. 175 // changes, so we clear BASE_SERVER_SPECIFICS.
176 target_entry.Put(syncable::BASE_SERVER_SPECIFICS, 176 target_entry.Put(syncable::BASE_SERVER_SPECIFICS,
177 sync_pb::EntitySpecifics()); 177 sync_pb::EntitySpecifics());
178 } 178 }
179 179
180 UpdateServerFieldsFromUpdate(&target_entry, update, name); 180 UpdateServerFieldsFromUpdate(&target_entry, update, name);
181 181
182 return SUCCESS_PROCESSED; 182 return SUCCESS_PROCESSED;
183 } 183 }
184 184
185 } // namespace syncer 185 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/process_commit_response_command_unittest.cc ('k') | sync/engine/process_updates_command_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698