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

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

Issue 371029: Remove unique naming. (Closed)
Patch Set: Ready and about to go in! Created 11 years, 1 month 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/process_updates_command.h" 5 #include "chrome/browser/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 "chrome/browser/sync/engine/syncer.h" 10 #include "chrome/browser/sync/engine/syncer.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } // namespace 127 } // namespace
128 128
129 // TODO(sync): Refactor this code. 129 // TODO(sync): Refactor this code.
130 // Process a single update. Will avoid touching global state. 130 // Process a single update. Will avoid touching global state.
131 ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate( 131 ServerUpdateProcessingResult ProcessUpdatesCommand::ProcessUpdate(
132 const syncable::ScopedDirLookup& dir, const sync_pb::SyncEntity& pb_entry) { 132 const syncable::ScopedDirLookup& dir, const sync_pb::SyncEntity& pb_entry) {
133 133
134 const SyncEntity& entry = *static_cast<const SyncEntity*>(&pb_entry); 134 const SyncEntity& entry = *static_cast<const SyncEntity*>(&pb_entry);
135 using namespace syncable; 135 using namespace syncable;
136 syncable::Id id = entry.id(); 136 syncable::Id id = entry.id();
137 SyncName name = SyncerProtoUtil::NameFromSyncEntity(entry); 137 const std::string name =
138 SyncerProtoUtil::NameFromSyncEntity(entry);
138 139
139 WriteTransaction trans(dir, SYNCER, __FILE__, __LINE__); 140 WriteTransaction trans(dir, SYNCER, __FILE__, __LINE__);
140 141
141 SyncerUtil::CreateNewEntry(&trans, id); 142 SyncerUtil::CreateNewEntry(&trans, id);
142 143
143 // We take a two step approach. First we store the entries data in the 144 // We take a two step approach. First we store the entries data in the
144 // server fields of a local entry and then move the data to the local fields 145 // server fields of a local entry and then move the data to the local fields
145 MutableEntry update_entry(&trans, GET_BY_ID, id); 146 MutableEntry update_entry(&trans, GET_BY_ID, id);
146 // TODO(sync): do we need to run ALL these checks, or is a mere version check 147 // TODO(sync): do we need to run ALL these checks, or is a mere version check
147 // good enough? 148 // good enough?
148 if (!ReverifyEntry(&trans, entry, &update_entry)) { 149 if (!ReverifyEntry(&trans, entry, &update_entry)) {
149 return SUCCESS_PROCESSED; // the entry has become irrelevant 150 return SUCCESS_PROCESSED; // the entry has become irrelevant
150 } 151 }
151 152
152 SyncerUtil::UpdateServerFieldsFromUpdate(&update_entry, entry, name); 153 SyncerUtil::UpdateServerFieldsFromUpdate(&update_entry, entry, name);
153 154
154 if (update_entry.Get(SERVER_VERSION) == update_entry.Get(BASE_VERSION) && 155 if (update_entry.Get(SERVER_VERSION) == update_entry.Get(BASE_VERSION) &&
155 !update_entry.Get(IS_UNSYNCED)) { 156 !update_entry.Get(IS_UNSYNCED)) {
156 CHECK(SyncerUtil::ServerAndLocalEntriesMatch( 157 // Previously this was a big issue but at this point we don't really care
157 &update_entry)) << update_entry; 158 // that much if things don't match up exactly.
159 LOG_IF(ERROR, !SyncerUtil::ServerAndLocalEntriesMatch(&update_entry))
160 << update_entry;
158 } 161 }
159 return SUCCESS_PROCESSED; 162 return SUCCESS_PROCESSED;
160 } 163 }
161 164
162 } // namespace browser_sync 165 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/process_commit_response_command.cc ('k') | chrome/browser/sync/engine/syncapi.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698