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

Side by Side Diff: sync/test/fake_server/permanent_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, 2 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/permanent_entity.h ('k') | sync/test/fake_server/tombstone_entity.h » ('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/test/fake_server/permanent_entity.h" 5 #include "sync/test/fake_server/permanent_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/logging.h" 10 #include "base/logging.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 const sync_pb::EntitySpecifics& specifics) 91 const sync_pb::EntitySpecifics& specifics)
92 : FakeServerEntity(id, model_type, 0, name), 92 : FakeServerEntity(id, model_type, 0, name),
93 server_defined_unique_tag_(server_defined_unique_tag), 93 server_defined_unique_tag_(server_defined_unique_tag),
94 parent_id_(parent_id), 94 parent_id_(parent_id),
95 specifics_(specifics) { } 95 specifics_(specifics) { }
96 96
97 string PermanentEntity::GetParentId() const { 97 string PermanentEntity::GetParentId() const {
98 return parent_id_; 98 return parent_id_;
99 } 99 }
100 100
101 sync_pb::SyncEntity* PermanentEntity::SerializeAsProto() { 101 void PermanentEntity::SerializeAsProto(sync_pb::SyncEntity* proto) {
102 sync_pb::SyncEntity* sync_entity = new sync_pb::SyncEntity(); 102 FakeServerEntity::SerializeBaseProtoFields(proto);
103 FakeServerEntity::SerializeBaseProtoFields(sync_entity);
104 103
105 sync_pb::EntitySpecifics* specifics = sync_entity->mutable_specifics(); 104 sync_pb::EntitySpecifics* specifics = proto->mutable_specifics();
106 specifics->CopyFrom(specifics_); 105 specifics->CopyFrom(specifics_);
107 106
108 sync_entity->set_parent_id_string(parent_id_); 107 proto->set_parent_id_string(parent_id_);
109 sync_entity->set_server_defined_unique_tag(server_defined_unique_tag_); 108 proto->set_server_defined_unique_tag(server_defined_unique_tag_);
110
111 return sync_entity;
112 } 109 }
113 110
114 bool PermanentEntity::IsDeleted() const { 111 bool PermanentEntity::IsDeleted() const {
115 return false; 112 return false;
116 } 113 }
117 114
118 bool PermanentEntity::IsFolder() const { 115 bool PermanentEntity::IsFolder() const {
119 return true; 116 return true;
120 } 117 }
121 118
122 } // namespace fake_server 119 } // namespace fake_server
OLDNEW
« no previous file with comments | « sync/test/fake_server/permanent_entity.h ('k') | sync/test/fake_server/tombstone_entity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698