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

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

Issue 891123003: Revert of Sync commit errors should temporarily re-enable trigger pre-commit getupdates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « sync/engine/commit.h ('k') | sync/engine/sync_scheduler_impl.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/commit.h" 5 #include "sync/engine/commit.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "sync/engine/commit_contribution.h" 8 #include "sync/engine/commit_contribution.h"
9 #include "sync/engine/commit_processor.h" 9 #include "sync/engine/commit_processor.h"
10 #include "sync/engine/commit_util.h" 10 #include "sync/engine/commit_util.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 for (std::map<ModelType, CommitContribution*>::iterator it = 76 for (std::map<ModelType, CommitContribution*>::iterator it =
77 contributions.begin(); it != contributions.end(); ++it) { 77 contributions.begin(); it != contributions.end(); ++it) {
78 it->second->AddToCommitMessage(&message); 78 it->second->AddToCommitMessage(&message);
79 } 79 }
80 80
81 // If we made it this far, then we've successfully prepared a commit message. 81 // If we made it this far, then we've successfully prepared a commit message.
82 return new Commit(contributions, message, extensions_activity_buffer); 82 return new Commit(contributions, message, extensions_activity_buffer);
83 } 83 }
84 84
85 SyncerError Commit::PostAndProcessResponse( 85 SyncerError Commit::PostAndProcessResponse(
86 sessions::NudgeTracker* nudge_tracker,
87 sessions::SyncSession* session, 86 sessions::SyncSession* session,
88 sessions::StatusController* status, 87 sessions::StatusController* status,
89 ExtensionsActivity* extensions_activity) { 88 ExtensionsActivity* extensions_activity) {
90 ModelTypeSet request_types; 89 ModelTypeSet request_types;
91 for (ContributionMap::const_iterator it = contributions_.begin(); 90 for (ContributionMap::const_iterator it = contributions_.begin();
92 it != contributions_.end(); ++it) { 91 it != contributions_.end(); ++it) {
93 request_types.Put(it->first); 92 request_types.Put(it->first);
94 } 93 }
95 session->mutable_status_controller()->set_commit_request_types(request_types); 94 session->mutable_status_controller()->set_commit_request_types(request_types);
96 95
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 146 }
148 147
149 // Let the contributors process the responses to each of their requests. 148 // Let the contributors process the responses to each of their requests.
150 SyncerError processing_result = SYNCER_OK; 149 SyncerError processing_result = SYNCER_OK;
151 for (std::map<ModelType, CommitContribution*>::iterator it = 150 for (std::map<ModelType, CommitContribution*>::iterator it =
152 contributions_.begin(); it != contributions_.end(); ++it) { 151 contributions_.begin(); it != contributions_.end(); ++it) {
153 TRACE_EVENT1("sync", "ProcessCommitResponse", 152 TRACE_EVENT1("sync", "ProcessCommitResponse",
154 "type", ModelTypeToString(it->first)); 153 "type", ModelTypeToString(it->first));
155 SyncerError type_result = 154 SyncerError type_result =
156 it->second->ProcessCommitResponse(response_, status); 155 it->second->ProcessCommitResponse(response_, status);
157 if (type_result == SERVER_RETURN_CONFLICT) {
158 nudge_tracker->RecordCommitConflict(it->first);
159 }
160 if (processing_result == SYNCER_OK && type_result != SYNCER_OK) { 156 if (processing_result == SYNCER_OK && type_result != SYNCER_OK) {
161 processing_result = type_result; 157 processing_result = type_result;
162 } 158 }
163 } 159 }
164 160
165 // Handle bookmarks' special extensions activity stats. 161 // Handle bookmarks' special extensions activity stats.
166 if (session->status_controller(). 162 if (session->status_controller().
167 model_neutral_state().num_successful_bookmark_commits == 0) { 163 model_neutral_state().num_successful_bookmark_commits == 0) {
168 extensions_activity->PutRecords(extensions_activity_buffer_); 164 extensions_activity->PutRecords(extensions_activity_buffer_);
169 } 165 }
170 166
171 return processing_result; 167 return processing_result;
172 } 168 }
173 169
174 void Commit::CleanUp() { 170 void Commit::CleanUp() {
175 for (ContributionMap::iterator it = contributions_.begin(); 171 for (ContributionMap::iterator it = contributions_.begin();
176 it != contributions_.end(); ++it) { 172 it != contributions_.end(); ++it) {
177 it->second->CleanUp(); 173 it->second->CleanUp();
178 } 174 }
179 cleaned_up_ = true; 175 cleaned_up_ = true;
180 } 176 }
181 177
182 } // namespace syncer 178 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/engine/commit.h ('k') | sync/engine/sync_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698