| 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/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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |