| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // the commit message which should be sent to the server. It is valid iff the | 63 // the commit message which should be sent to the server. It is valid iff the |
| 64 // return value of this function is true. | 64 // return value of this function is true. |
| 65 bool PrepareCommitMessage(sessions::SyncSession* session, | 65 bool PrepareCommitMessage(sessions::SyncSession* session, |
| 66 sessions::OrderedCommitSet* commit_set, | 66 sessions::OrderedCommitSet* commit_set, |
| 67 ClientToServerMessage* commit_message) { | 67 ClientToServerMessage* commit_message) { |
| 68 TRACE_EVENT0("sync", "PrepareCommitMessage"); | 68 TRACE_EVENT0("sync", "PrepareCommitMessage"); |
| 69 | 69 |
| 70 commit_set->Clear(); | 70 commit_set->Clear(); |
| 71 commit_message->Clear(); | 71 commit_message->Clear(); |
| 72 | 72 |
| 73 // TODO(134769): This is a temporary fix for crbug.com/134715. |
| 74 commit_message->set_protocol_version(commit_message->protocol_version()); |
| 75 |
| 73 WriteTransaction trans(FROM_HERE, SYNCER, session->context()->directory()); | 76 WriteTransaction trans(FROM_HERE, SYNCER, session->context()->directory()); |
| 74 sessions::ScopedSetSessionWriteTransaction set_trans(session, &trans); | 77 sessions::ScopedSetSessionWriteTransaction set_trans(session, &trans); |
| 75 | 78 |
| 76 // Fetch the items to commit. | 79 // Fetch the items to commit. |
| 77 const size_t batch_size = session->context()->max_commit_batch_size(); | 80 const size_t batch_size = session->context()->max_commit_batch_size(); |
| 78 GetCommitIdsCommand get_commit_ids_command(batch_size, commit_set); | 81 GetCommitIdsCommand get_commit_ids_command(batch_size, commit_set); |
| 79 get_commit_ids_command.Execute(session); | 82 get_commit_ids_command.Execute(session); |
| 80 | 83 |
| 81 DVLOG(1) << "Commit message will contain " << commit_set->Size() << " items."; | 84 DVLOG(1) << "Commit message will contain " << commit_set->Size() << " items."; |
| 82 if (commit_set->Empty()) { | 85 if (commit_set->Empty()) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 sessions::SyncSession* session) { | 150 sessions::SyncSession* session) { |
| 148 sessions::OrderedCommitSet commit_set(session->routing_info()); | 151 sessions::OrderedCommitSet commit_set(session->routing_info()); |
| 149 SyncerError result = BuildAndPostCommitsImpl(syncer, session, &commit_set); | 152 SyncerError result = BuildAndPostCommitsImpl(syncer, session, &commit_set); |
| 150 if (result != SYNCER_OK) { | 153 if (result != SYNCER_OK) { |
| 151 ClearSyncingBits(session->context()->directory(), commit_set); | 154 ClearSyncingBits(session->context()->directory(), commit_set); |
| 152 } | 155 } |
| 153 return result; | 156 return result; |
| 154 } | 157 } |
| 155 | 158 |
| 156 } // namespace csync | 159 } // namespace csync |
| OLD | NEW |