Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: sync/engine/worker_entity_tracker.cc

Issue 1893813002: [Sync] Adjust new entity version before commit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@DeviceInfoFixes
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sync/engine/worker_entity_tracker.h ('k') | sync/engine/worker_entity_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/worker_entity_tracker.h" 5 #include "sync/engine/worker_entity_tracker.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "sync/internal_api/public/base/model_type.h" 10 #include "sync/internal_api/public/base/model_type.h"
(...skipping 13 matching lines...) Expand all
24 base_version_(kUncommittedVersion) { 24 base_version_(kUncommittedVersion) {
25 DCHECK(!client_tag_hash_.empty()); 25 DCHECK(!client_tag_hash_.empty());
26 } 26 }
27 27
28 WorkerEntityTracker::~WorkerEntityTracker() {} 28 WorkerEntityTracker::~WorkerEntityTracker() {}
29 29
30 bool WorkerEntityTracker::HasPendingCommit() const { 30 bool WorkerEntityTracker::HasPendingCommit() const {
31 return !!pending_commit_; 31 return !!pending_commit_;
32 } 32 }
33 33
34 void WorkerEntityTracker::PrepareCommitProto(sync_pb::SyncEntity* commit_entity, 34 void WorkerEntityTracker::PopulateCommitProto(
35 int64_t* sequence_number) const { 35 sync_pb::SyncEntity* commit_entity,
36 int64_t* sequence_number) const {
36 DCHECK(HasPendingCommit()); 37 DCHECK(HasPendingCommit());
37 DCHECK(!client_tag_hash_.empty()); 38 DCHECK(!client_tag_hash_.empty());
38 39
39 if (!id_.empty()) { 40 if (!id_.empty()) {
40 commit_entity->set_id_string(id_); 41 commit_entity->set_id_string(id_);
41 } 42 }
42 43
43 const EntityData& entity = pending_commit_->entity.value(); 44 const EntityData& entity = pending_commit_->entity.value();
44 DCHECK_EQ(client_tag_hash_, entity.client_tag_hash); 45 DCHECK_EQ(client_tag_hash_, entity.client_tag_hash);
45 46
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 bool WorkerEntityTracker::IsServerKnown() const { 196 bool WorkerEntityTracker::IsServerKnown() const {
196 return base_version_ != kUncommittedVersion; 197 return base_version_ != kUncommittedVersion;
197 } 198 }
198 199
199 void WorkerEntityTracker::ClearPendingCommit() { 200 void WorkerEntityTracker::ClearPendingCommit() {
200 pending_commit_.reset(); 201 pending_commit_.reset();
201 } 202 }
202 203
203 } // namespace syncer_v2 204 } // namespace syncer_v2
OLDNEW
« no previous file with comments | « sync/engine/worker_entity_tracker.h ('k') | sync/engine/worker_entity_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698