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

Side by Side Diff: sync/engine/syncer_util.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
« no previous file with comments | « sync/engine/syncer_util.h ('k') | sync/engine/throttled_data_type_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/syncer_util.h" 5 #include "sync/engine/syncer_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // passphrase may not arrive within this GetUpdates, we can't just return 244 // passphrase may not arrive within this GetUpdates, we can't just return
245 // conflict, else we try to perform normal conflict resolution prematurely or 245 // conflict, else we try to perform normal conflict resolution prematurely or
246 // the syncer may get stuck. As such, we return CONFLICT_ENCRYPTION, which is 246 // the syncer may get stuck. As such, we return CONFLICT_ENCRYPTION, which is
247 // treated as an unresolvable conflict. See the description in syncer_types.h. 247 // treated as an unresolvable conflict. See the description in syncer_types.h.
248 // This prevents any unsynced changes from commiting and postpones conflict 248 // This prevents any unsynced changes from commiting and postpones conflict
249 // resolution until all data can be decrypted. 249 // resolution until all data can be decrypted.
250 if (specifics.has_encrypted() && 250 if (specifics.has_encrypted() &&
251 !cryptographer->CanDecrypt(specifics.encrypted())) { 251 !cryptographer->CanDecrypt(specifics.encrypted())) {
252 // We can't decrypt this node yet. 252 // We can't decrypt this node yet.
253 DVLOG(1) << "Received an undecryptable " 253 DVLOG(1) << "Received an undecryptable "
254 << syncer::ModelTypeToString(entry->GetServerModelType()) 254 << ModelTypeToString(entry->GetServerModelType())
255 << " update, returning encryption_conflict."; 255 << " update, returning encryption_conflict.";
256 return CONFLICT_ENCRYPTION; 256 return CONFLICT_ENCRYPTION;
257 } else if (specifics.has_password() && 257 } else if (specifics.has_password() &&
258 entry->Get(UNIQUE_SERVER_TAG).empty()) { 258 entry->Get(UNIQUE_SERVER_TAG).empty()) {
259 // Passwords use their own legacy encryption scheme. 259 // Passwords use their own legacy encryption scheme.
260 const sync_pb::PasswordSpecifics& password = specifics.password(); 260 const sync_pb::PasswordSpecifics& password = specifics.password();
261 if (!cryptographer->CanDecrypt(password.encrypted())) { 261 if (!cryptographer->CanDecrypt(password.encrypted())) {
262 DVLOG(1) << "Received an undecryptable password update, returning " 262 DVLOG(1) << "Received an undecryptable password update, returning "
263 << "encryption_conflict."; 263 << "encryption_conflict.";
264 return CONFLICT_ENCRYPTION; 264 return CONFLICT_ENCRYPTION;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 297
298 if (entry->Get(IS_UNSYNCED)) { 298 if (entry->Get(IS_UNSYNCED)) {
299 DVLOG(1) << "Skipping update, returning conflict for: " << id 299 DVLOG(1) << "Skipping update, returning conflict for: " << id
300 << " ; it's unsynced."; 300 << " ; it's unsynced.";
301 return CONFLICT_SIMPLE; 301 return CONFLICT_SIMPLE;
302 } 302 }
303 303
304 if (specifics.has_encrypted()) { 304 if (specifics.has_encrypted()) {
305 DVLOG(2) << "Received a decryptable " 305 DVLOG(2) << "Received a decryptable "
306 << syncer::ModelTypeToString(entry->GetServerModelType()) 306 << ModelTypeToString(entry->GetServerModelType())
307 << " update, applying normally."; 307 << " update, applying normally.";
308 } else { 308 } else {
309 DVLOG(2) << "Received an unencrypted " 309 DVLOG(2) << "Received an unencrypted "
310 << syncer::ModelTypeToString(entry->GetServerModelType()) 310 << ModelTypeToString(entry->GetServerModelType())
311 << " update, applying normally."; 311 << " update, applying normally.";
312 } 312 }
313 313
314 UpdateLocalDataFromServerData(trans, entry); 314 UpdateLocalDataFromServerData(trans, entry);
315 315
316 return SUCCESS; 316 return SUCCESS;
317 } 317 }
318 318
319 namespace { 319 namespace {
320 // Helper to synthesize a new-style sync_pb::EntitySpecifics for use locally, 320 // Helper to synthesize a new-style sync_pb::EntitySpecifics for use locally,
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 } 589 }
590 590
591 // Assumes we have an existing entry; check here for updates that break 591 // Assumes we have an existing entry; check here for updates that break
592 // consistency rules. 592 // consistency rules.
593 VerifyResult VerifyUpdateConsistency( 593 VerifyResult VerifyUpdateConsistency(
594 syncable::WriteTransaction* trans, 594 syncable::WriteTransaction* trans,
595 const sync_pb::SyncEntity& update, 595 const sync_pb::SyncEntity& update,
596 syncable::MutableEntry* target, 596 syncable::MutableEntry* target,
597 const bool deleted, 597 const bool deleted,
598 const bool is_directory, 598 const bool is_directory,
599 syncer::ModelType model_type) { 599 ModelType model_type) {
600 600
601 CHECK(target->good()); 601 CHECK(target->good());
602 const syncable::Id& update_id = SyncableIdFromProto(update.id_string()); 602 const syncable::Id& update_id = SyncableIdFromProto(update.id_string());
603 603
604 // If the update is a delete, we don't really need to worry at this stage. 604 // If the update is a delete, we don't really need to worry at this stage.
605 if (deleted) 605 if (deleted)
606 return VERIFY_SUCCESS; 606 return VERIFY_SUCCESS;
607 607
608 if (model_type == syncer::UNSPECIFIED) { 608 if (model_type == UNSPECIFIED) {
609 // This update is to an item of a datatype we don't recognize. The server 609 // This update is to an item of a datatype we don't recognize. The server
610 // shouldn't have sent it to us. Throw it on the ground. 610 // shouldn't have sent it to us. Throw it on the ground.
611 return VERIFY_SKIP; 611 return VERIFY_SKIP;
612 } 612 }
613 613
614 if (target->Get(SERVER_VERSION) > 0) { 614 if (target->Get(SERVER_VERSION) > 0) {
615 // Then we've had an update for this entry before. 615 // Then we've had an update for this entry before.
616 if (is_directory != target->Get(SERVER_IS_DIR) || 616 if (is_directory != target->Get(SERVER_IS_DIR) ||
617 model_type != target->GetServerModelType()) { 617 model_type != target->GetServerModelType()) {
618 if (target->Get(IS_DEL)) { // If we've deleted the item, we don't care. 618 if (target->Get(IS_DEL)) { // If we've deleted the item, we don't care.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 if (update.version() < target->Get(SERVER_VERSION)) { 692 if (update.version() < target->Get(SERVER_VERSION)) {
693 LOG(WARNING) << "Update older than current server version for " 693 LOG(WARNING) << "Update older than current server version for "
694 << *target << " Update:" 694 << *target << " Update:"
695 << SyncerProtoUtil::SyncEntityDebugString(update); 695 << SyncerProtoUtil::SyncEntityDebugString(update);
696 return VERIFY_SUCCESS; // Expected in new sync protocol. 696 return VERIFY_SUCCESS; // Expected in new sync protocol.
697 } 697 }
698 return VERIFY_UNDECIDED; 698 return VERIFY_UNDECIDED;
699 } 699 }
700 700
701 } // namespace syncer 701 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/syncer_util.h ('k') | sync/engine/throttled_data_type_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698