OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/model_thread_sync_entity.h" | 5 #include "sync/engine/model_thread_sync_entity.h" |
6 #include "sync/syncable/syncable_util.h" | 6 #include "sync/syncable/syncable_util.h" |
7 | 7 |
8 namespace syncer { | 8 namespace syncer { |
9 | 9 |
10 scoped_ptr<ModelThreadSyncEntity> ModelThreadSyncEntity::NewLocalItem( | 10 scoped_ptr<ModelThreadSyncEntity> ModelThreadSyncEntity::NewLocalItem( |
11 const std::string& client_tag, | 11 const std::string& client_tag, |
12 const sync_pb::EntitySpecifics& specifics, | 12 const sync_pb::EntitySpecifics& specifics, |
13 base::Time now) { | 13 base::Time now) { |
14 return scoped_ptr<ModelThreadSyncEntity>(new ModelThreadSyncEntity( | 14 return scoped_ptr<ModelThreadSyncEntity>(new ModelThreadSyncEntity( |
15 1, | 15 1, |
16 0, | 16 0, |
17 0, | 17 0, |
18 0, | 18 kUncommittedVersion, |
19 true, | 19 true, |
20 std::string(), // Sync thread will assign the initial ID. | 20 std::string(), // Sync thread will assign the initial ID. |
21 syncable::GenerateSyncableHash(GetModelTypeFromSpecifics(specifics), | 21 syncable::GenerateSyncableHash(GetModelTypeFromSpecifics(specifics), |
22 client_tag), | 22 client_tag), |
23 client_tag, // As non-unique name. | 23 client_tag, // As non-unique name. |
24 specifics, | 24 specifics, |
25 false, | 25 false, |
26 now, | 26 now, |
27 now)); | 27 now)); |
28 } | 28 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 void ModelThreadSyncEntity::ReceiveCommitResponse(const std::string& id, | 149 void ModelThreadSyncEntity::ReceiveCommitResponse(const std::string& id, |
150 int64 sequence_number, | 150 int64 sequence_number, |
151 int64 response_version) { | 151 int64 response_version) { |
152 id_ = id; // The server can assign us a new ID in a commit response. | 152 id_ = id; // The server can assign us a new ID in a commit response. |
153 acked_sequence_number_ = sequence_number; | 153 acked_sequence_number_ = sequence_number; |
154 base_version_ = response_version; | 154 base_version_ = response_version; |
155 } | 155 } |
156 | 156 |
157 } // namespace syncer | 157 } // namespace syncer |
OLD | NEW |