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