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

Side by Side Diff: sync/test/fake_server/unique_client_entity.cc

Issue 600083003: Fix memory leak in Sync FakeServerEntity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Created 6 years, 3 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/test/fake_server/unique_client_entity.h ('k') | no next file » | 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/test/fake_server/unique_client_entity.h" 5 #include "sync/test/fake_server/unique_client_entity.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 specifics_(specifics), 61 specifics_(specifics),
62 creation_time_(creation_time), 62 creation_time_(creation_time),
63 last_modified_time_(last_modified_time) { } 63 last_modified_time_(last_modified_time) { }
64 64
65 string UniqueClientEntity::GetParentId() const { 65 string UniqueClientEntity::GetParentId() const {
66 // The parent ID for this type of entity should always be its ModelType's 66 // The parent ID for this type of entity should always be its ModelType's
67 // root node. 67 // root node.
68 return FakeServerEntity::GetTopLevelId(model_type_); 68 return FakeServerEntity::GetTopLevelId(model_type_);
69 } 69 }
70 70
71 sync_pb::SyncEntity* UniqueClientEntity::SerializeAsProto() { 71 void UniqueClientEntity::SerializeAsProto(sync_pb::SyncEntity* proto) {
72 sync_pb::SyncEntity* sync_entity = new sync_pb::SyncEntity(); 72 FakeServerEntity::SerializeBaseProtoFields(proto);
73 FakeServerEntity::SerializeBaseProtoFields(sync_entity);
74 73
75 sync_pb::EntitySpecifics* specifics = sync_entity->mutable_specifics(); 74 sync_pb::EntitySpecifics* specifics = proto->mutable_specifics();
76 specifics->CopyFrom(specifics_); 75 specifics->CopyFrom(specifics_);
77 76
78 sync_entity->set_parent_id_string(GetParentId()); 77 proto->set_parent_id_string(GetParentId());
79 sync_entity->set_client_defined_unique_tag(client_defined_unique_tag_); 78 proto->set_client_defined_unique_tag(client_defined_unique_tag_);
80 sync_entity->set_ctime(creation_time_); 79 proto->set_ctime(creation_time_);
81 sync_entity->set_mtime(last_modified_time_); 80 proto->set_mtime(last_modified_time_);
82
83 return sync_entity;
84 } 81 }
85 82
86 bool UniqueClientEntity::IsDeleted() const { 83 bool UniqueClientEntity::IsDeleted() const {
87 return false; 84 return false;
88 } 85 }
89 86
90 bool UniqueClientEntity::IsFolder() const { 87 bool UniqueClientEntity::IsFolder() const {
91 return false; 88 return false;
92 } 89 }
93 90
94 } // namespace fake_server 91 } // namespace fake_server
OLDNEW
« no previous file with comments | « sync/test/fake_server/unique_client_entity.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698