OLD | NEW |
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/build_commit_command.h" | 5 #include "sync/engine/build_commit_command.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 SyncerError BuildCommitCommand::ExecuteImpl(SyncSession* session) { | 112 SyncerError BuildCommitCommand::ExecuteImpl(SyncSession* session) { |
113 commit_message_->set_share(session->context()->account_name()); | 113 commit_message_->set_share(session->context()->account_name()); |
114 commit_message_->set_message_contents(sync_pb::ClientToServerMessage::COMMIT); | 114 commit_message_->set_message_contents(sync_pb::ClientToServerMessage::COMMIT); |
115 | 115 |
116 sync_pb::CommitMessage* commit_message = commit_message_->mutable_commit(); | 116 sync_pb::CommitMessage* commit_message = commit_message_->mutable_commit(); |
117 commit_message->set_cache_guid(trans_->directory()->cache_guid()); | 117 commit_message->set_cache_guid(trans_->directory()->cache_guid()); |
118 AddExtensionsActivityToMessage(session, commit_message); | 118 AddExtensionsActivityToMessage(session, commit_message); |
119 AddClientConfigParamsToMessage(session, commit_message); | 119 AddClientConfigParamsToMessage(session, commit_message); |
120 | 120 |
121 for (size_t i = 0; i < batch_commit_set_.Size(); i++) { | 121 for (size_t i = 0; i < batch_commit_set_.Size(); i++) { |
122 Id id = batch_commit_set_.GetCommitIdAt(i); | 122 int64 handle = batch_commit_set_.GetCommitHandleAt(i); |
123 sync_pb::SyncEntity* sync_entry = commit_message->add_entries(); | 123 sync_pb::SyncEntity* sync_entry = commit_message->add_entries(); |
124 | 124 |
125 Entry meta_entry(trans_, syncable::GET_BY_ID, id); | 125 Entry meta_entry(trans_, syncable::GET_BY_HANDLE, handle); |
126 CHECK(meta_entry.good()); | 126 CHECK(meta_entry.good()); |
127 | 127 |
128 DCHECK_NE(0UL, | 128 DCHECK_NE(0UL, |
129 session->context()->routing_info().count( | 129 session->context()->routing_info().count( |
130 meta_entry.GetModelType())) | 130 meta_entry.GetModelType())) |
131 << "Committing change to datatype that's not actively enabled."; | 131 << "Committing change to datatype that's not actively enabled."; |
132 | 132 |
133 BuildCommitItem(meta_entry, sync_entry); | 133 BuildCommitItem(meta_entry, sync_entry); |
134 } | 134 } |
135 | 135 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 sync_entry->set_position_in_parent( | 216 sync_entry->set_position_in_parent( |
217 meta_entry.Get(UNIQUE_POSITION).ToInt64()); | 217 meta_entry.Get(UNIQUE_POSITION).ToInt64()); |
218 meta_entry.Get(UNIQUE_POSITION).ToProto( | 218 meta_entry.Get(UNIQUE_POSITION).ToProto( |
219 sync_entry->mutable_unique_position()); | 219 sync_entry->mutable_unique_position()); |
220 } | 220 } |
221 SetEntrySpecifics(meta_entry, sync_entry); | 221 SetEntrySpecifics(meta_entry, sync_entry); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 } // namespace syncer | 225 } // namespace syncer |
OLD | NEW |