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

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

Issue 10909160: sync: Process client commands on commit response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor formatting improvement Created 8 years, 3 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 | « no previous file | sync/engine/download_updates_command.cc » ('j') | sync/sessions/sync_session.cc » ('J')
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/commit.h" 5 #include "sync/engine/commit.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "sync/engine/build_commit_command.h" 8 #include "sync/engine/build_commit_command.h"
9 #include "sync/engine/get_commit_ids_command.h" 9 #include "sync/engine/get_commit_ids_command.h"
10 #include "sync/engine/process_commit_response_command.h" 10 #include "sync/engine/process_commit_response_command.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 const size_t num_responses = commit_response.commit().entryresponse_size(); 117 const size_t num_responses = commit_response.commit().entryresponse_size();
118 if (num_responses != commit_set->Size()) { 118 if (num_responses != commit_set->Size()) {
119 LOG(ERROR) 119 LOG(ERROR)
120 << "Commit response has wrong number of entries! " 120 << "Commit response has wrong number of entries! "
121 << "Expected: " << commit_set->Size() << ", " 121 << "Expected: " << commit_set->Size() << ", "
122 << "Got: " << num_responses; 122 << "Got: " << num_responses;
123 return SERVER_RESPONSE_VALIDATION_FAILED; 123 return SERVER_RESPONSE_VALIDATION_FAILED;
124 } 124 }
125 125
126 if (commit_response.has_client_command()) {
127 session->ProcessClientCommand(commit_response.client_command());
128 }
129
126 TRACE_EVENT_BEGIN0("sync", "ProcessCommitResponse"); 130 TRACE_EVENT_BEGIN0("sync", "ProcessCommitResponse");
127 ProcessCommitResponseCommand process_response_command( 131 ProcessCommitResponseCommand process_response_command(
128 *commit_set, commit_message, commit_response); 132 *commit_set, commit_message, commit_response);
129 const SyncerError processing_result = 133 const SyncerError processing_result =
130 process_response_command.Execute(session); 134 process_response_command.Execute(session);
131 TRACE_EVENT_END0("sync", "ProcessCommitResponse"); 135 TRACE_EVENT_END0("sync", "ProcessCommitResponse");
132 136
133 if (processing_result != SYNCER_OK) { 137 if (processing_result != SYNCER_OK) {
134 return processing_result; 138 return processing_result;
135 } 139 }
(...skipping 10 matching lines...) Expand all
146 sessions::SyncSession* session) { 150 sessions::SyncSession* session) {
147 sessions::OrderedCommitSet commit_set(session->routing_info()); 151 sessions::OrderedCommitSet commit_set(session->routing_info());
148 SyncerError result = BuildAndPostCommitsImpl(syncer, session, &commit_set); 152 SyncerError result = BuildAndPostCommitsImpl(syncer, session, &commit_set);
149 if (result != SYNCER_OK) { 153 if (result != SYNCER_OK) {
150 ClearSyncingBits(session->context()->directory(), commit_set); 154 ClearSyncingBits(session->context()->directory(), commit_set);
151 } 155 }
152 return result; 156 return result;
153 } 157 }
154 158
155 } // namespace syncer 159 } // namespace syncer
OLDNEW
« no previous file with comments | « no previous file | sync/engine/download_updates_command.cc » ('j') | sync/sessions/sync_session.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698