| OLD | NEW |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 sessions::SyncSession* session, | 94 sessions::SyncSession* session, |
| 95 sessions::OrderedCommitSet* commit_set) { | 95 sessions::OrderedCommitSet* commit_set) { |
| 96 sync_pb::ClientToServerMessage commit_message; | 96 sync_pb::ClientToServerMessage commit_message; |
| 97 while (!syncer->ExitRequested() && | 97 while (!syncer->ExitRequested() && |
| 98 PrepareCommitMessage(session, commit_set, &commit_message)) { | 98 PrepareCommitMessage(session, commit_set, &commit_message)) { |
| 99 sync_pb::ClientToServerResponse commit_response; | 99 sync_pb::ClientToServerResponse commit_response; |
| 100 | 100 |
| 101 DVLOG(1) << "Sending commit message."; | 101 DVLOG(1) << "Sending commit message."; |
| 102 TRACE_EVENT_BEGIN0("sync", "PostCommit"); | 102 TRACE_EVENT_BEGIN0("sync", "PostCommit"); |
| 103 const SyncerError post_result = SyncerProtoUtil::PostClientToServerMessage( | 103 const SyncerError post_result = SyncerProtoUtil::PostClientToServerMessage( |
| 104 commit_message, &commit_response, session); | 104 &commit_message, &commit_response, session); |
| 105 TRACE_EVENT_END0("sync", "PostCommit"); | 105 TRACE_EVENT_END0("sync", "PostCommit"); |
| 106 | 106 |
| 107 if (post_result != SYNCER_OK) { | 107 if (post_result != SYNCER_OK) { |
| 108 LOG(WARNING) << "Post commit failed"; | 108 LOG(WARNING) << "Post commit failed"; |
| 109 return post_result; | 109 return post_result; |
| 110 } | 110 } |
| 111 | 111 |
| 112 if (!commit_response.has_commit()) { | 112 if (!commit_response.has_commit()) { |
| 113 LOG(WARNING) << "Commit response has no commit body!"; | 113 LOG(WARNING) << "Commit response has no commit body!"; |
| 114 return SERVER_RESPONSE_VALIDATION_FAILED; | 114 return SERVER_RESPONSE_VALIDATION_FAILED; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 sessions::SyncSession* session) { | 146 sessions::SyncSession* session) { |
| 147 sessions::OrderedCommitSet commit_set(session->routing_info()); | 147 sessions::OrderedCommitSet commit_set(session->routing_info()); |
| 148 SyncerError result = BuildAndPostCommitsImpl(syncer, session, &commit_set); | 148 SyncerError result = BuildAndPostCommitsImpl(syncer, session, &commit_set); |
| 149 if (result != SYNCER_OK) { | 149 if (result != SYNCER_OK) { |
| 150 ClearSyncingBits(session->context()->directory(), commit_set); | 150 ClearSyncingBits(session->context()->directory(), commit_set); |
| 151 } | 151 } |
| 152 return result; | 152 return result; |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace syncer | 155 } // namespace syncer |
| OLD | NEW |