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

Side by Side Diff: components/sync/engine_impl/loopback_server/loopback_server_entity.cc

Issue 2969643002: Reland - Replace FakeServer's implementation with LoopbackServer invocations. (Closed)
Patch Set: Rebased on master. Created 3 years, 5 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
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 "components/sync/engine_impl/loopback_server/loopback_server_entity.h" 5 #include "components/sync/engine_impl/loopback_server/loopback_server_entity.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 28 matching lines...) Expand all
39 namespace syncer { 39 namespace syncer {
40 40
41 LoopbackServerEntity::~LoopbackServerEntity() {} 41 LoopbackServerEntity::~LoopbackServerEntity() {}
42 42
43 // static 43 // static
44 std::unique_ptr<LoopbackServerEntity> 44 std::unique_ptr<LoopbackServerEntity>
45 LoopbackServerEntity::CreateEntityFromProto( 45 LoopbackServerEntity::CreateEntityFromProto(
46 const sync_pb::LoopbackServerEntity& entity) { 46 const sync_pb::LoopbackServerEntity& entity) {
47 switch (entity.type()) { 47 switch (entity.type()) {
48 case sync_pb::LoopbackServerEntity_Type_TOMBSTONE: 48 case sync_pb::LoopbackServerEntity_Type_TOMBSTONE:
49 return PersistentTombstoneEntity::Create(entity.entity()); 49 return PersistentTombstoneEntity::CreateFromEntity(entity.entity());
50 case sync_pb::LoopbackServerEntity_Type_PERMANENT: 50 case sync_pb::LoopbackServerEntity_Type_PERMANENT:
51 return base::MakeUnique<PersistentPermanentEntity>( 51 return base::MakeUnique<PersistentPermanentEntity>(
52 entity.entity().id_string(), entity.entity().version(), 52 entity.entity().id_string(), entity.entity().version(),
53 syncer::GetModelType(entity.entity()), entity.entity().name(), 53 syncer::GetModelType(entity.entity()), entity.entity().name(),
54 entity.entity().parent_id_string(), 54 entity.entity().parent_id_string(),
55 entity.entity().server_defined_unique_tag(), 55 entity.entity().server_defined_unique_tag(),
56 entity.entity().specifics()); 56 entity.entity().specifics());
57 case sync_pb::LoopbackServerEntity_Type_BOOKMARK: 57 case sync_pb::LoopbackServerEntity_Type_BOOKMARK:
58 return PersistentBookmarkEntity::CreateFromEntity(entity.entity()); 58 return PersistentBookmarkEntity::CreateFromEntity(entity.entity());
59 case sync_pb::LoopbackServerEntity_Type_UNIQUE: 59 case sync_pb::LoopbackServerEntity_Type_UNIQUE:
60 return PersistentUniqueClientEntity::Create(entity.entity()); 60 return PersistentUniqueClientEntity::CreateFromEntity(entity.entity());
61 case sync_pb::LoopbackServerEntity_Type_UNKNOWN: 61 case sync_pb::LoopbackServerEntity_Type_UNKNOWN:
62 CHECK(false) << "Unknown type encountered"; 62 CHECK(false) << "Unknown type encountered";
63 return std::unique_ptr<LoopbackServerEntity>(nullptr); 63 return std::unique_ptr<LoopbackServerEntity>(nullptr);
64 } 64 }
65 NOTREACHED(); 65 NOTREACHED();
66 return std::unique_ptr<LoopbackServerEntity>(nullptr); 66 return std::unique_ptr<LoopbackServerEntity>(nullptr);
67 } 67 }
68 68
69 const std::string& LoopbackServerEntity::GetId() const { 69 const std::string& LoopbackServerEntity::GetId() const {
70 return id_; 70 return id_;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } 169 }
170 170
171 void LoopbackServerEntity::SerializeAsLoopbackServerEntity( 171 void LoopbackServerEntity::SerializeAsLoopbackServerEntity(
172 sync_pb::LoopbackServerEntity* entity) const { 172 sync_pb::LoopbackServerEntity* entity) const {
173 entity->set_type(GetLoopbackServerEntityType()); 173 entity->set_type(GetLoopbackServerEntityType());
174 entity->set_model_type(static_cast<int64_t>(GetModelType())); 174 entity->set_model_type(static_cast<int64_t>(GetModelType()));
175 SerializeAsProto(entity->mutable_entity()); 175 SerializeAsProto(entity->mutable_entity());
176 } 176 }
177 177
178 } // namespace syncer 178 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698