| 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 "components/sync/model_impl/processor_entity_tracker.h" | 5 #include "components/sync/model_impl/processor_entity_tracker.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
| 9 #include "base/trace_event/memory_usage_estimator.h" | 9 #include "base/trace_event/memory_usage_estimator.h" |
| 10 #include "components/sync/base/time.h" | 10 #include "components/sync/base/time.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 sync_pb::EntityMetadata* metadata) | 54 sync_pb::EntityMetadata* metadata) |
| 55 : storage_key_(storage_key), | 55 : storage_key_(storage_key), |
| 56 commit_requested_sequence_number_(metadata->acked_sequence_number()) { | 56 commit_requested_sequence_number_(metadata->acked_sequence_number()) { |
| 57 DCHECK(metadata->has_client_tag_hash()); | 57 DCHECK(metadata->has_client_tag_hash()); |
| 58 DCHECK(metadata->has_creation_time()); | 58 DCHECK(metadata->has_creation_time()); |
| 59 metadata_.Swap(metadata); | 59 metadata_.Swap(metadata); |
| 60 } | 60 } |
| 61 | 61 |
| 62 ProcessorEntityTracker::~ProcessorEntityTracker() {} | 62 ProcessorEntityTracker::~ProcessorEntityTracker() {} |
| 63 | 63 |
| 64 void ProcessorEntityTracker::SetStorageKey(const std::string& new_key) { |
| 65 storage_key_ = new_key; |
| 66 } |
| 67 |
| 64 void ProcessorEntityTracker::SetCommitData(EntityData* data) { | 68 void ProcessorEntityTracker::SetCommitData(EntityData* data) { |
| 65 DCHECK(data); | 69 DCHECK(data); |
| 66 // Update data's fields from metadata. | 70 // Update data's fields from metadata. |
| 67 data->client_tag_hash = metadata_.client_tag_hash(); | 71 data->client_tag_hash = metadata_.client_tag_hash(); |
| 68 if (!metadata_.server_id().empty()) | 72 if (!metadata_.server_id().empty()) |
| 69 data->id = metadata_.server_id(); | 73 data->id = metadata_.server_id(); |
| 70 data->creation_time = ProtoTimeToTime(metadata_.creation_time()); | 74 data->creation_time = ProtoTimeToTime(metadata_.creation_time()); |
| 71 data->modification_time = ProtoTimeToTime(metadata_.modification_time()); | 75 data->modification_time = ProtoTimeToTime(metadata_.modification_time()); |
| 72 DCHECK(MatchesSpecificsHash(data->specifics)); | 76 DCHECK(MatchesSpecificsHash(data->specifics)); |
| 73 | 77 |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 void ProcessorEntityTracker::UpdateSpecificsHash( | 265 void ProcessorEntityTracker::UpdateSpecificsHash( |
| 262 const sync_pb::EntitySpecifics& specifics) { | 266 const sync_pb::EntitySpecifics& specifics) { |
| 263 if (specifics.ByteSize() > 0) { | 267 if (specifics.ByteSize() > 0) { |
| 264 HashSpecifics(specifics, metadata_.mutable_specifics_hash()); | 268 HashSpecifics(specifics, metadata_.mutable_specifics_hash()); |
| 265 } else { | 269 } else { |
| 266 metadata_.clear_specifics_hash(); | 270 metadata_.clear_specifics_hash(); |
| 267 } | 271 } |
| 268 } | 272 } |
| 269 | 273 |
| 270 } // namespace syncer | 274 } // namespace syncer |
| OLD | NEW |