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

Side by Side Diff: sync/test/fake_server/bookmark_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/bookmark_entity.h ('k') | sync/test/fake_server/fake_server.cc » ('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/bookmark_entity.h" 5 #include "sync/test/fake_server/bookmark_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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 specifics_(specifics), 101 specifics_(specifics),
102 is_folder_(is_folder), 102 is_folder_(is_folder),
103 parent_id_(parent_id), 103 parent_id_(parent_id),
104 creation_time_(creation_time), 104 creation_time_(creation_time),
105 last_modified_time_(last_modified_time) { } 105 last_modified_time_(last_modified_time) { }
106 106
107 string BookmarkEntity::GetParentId() const { 107 string BookmarkEntity::GetParentId() const {
108 return parent_id_; 108 return parent_id_;
109 } 109 }
110 110
111 sync_pb::SyncEntity* BookmarkEntity::SerializeAsProto() { 111 void BookmarkEntity::SerializeAsProto(sync_pb::SyncEntity* proto) {
112 sync_pb::SyncEntity* sync_entity = new sync_pb::SyncEntity(); 112 FakeServerEntity::SerializeBaseProtoFields(proto);
113 FakeServerEntity::SerializeBaseProtoFields(sync_entity);
114 113
115 sync_pb::EntitySpecifics* specifics = sync_entity->mutable_specifics(); 114 sync_pb::EntitySpecifics* specifics = proto->mutable_specifics();
116 specifics->CopyFrom(specifics_); 115 specifics->CopyFrom(specifics_);
117 116
118 sync_entity->set_originator_cache_guid(originator_cache_guid_); 117 proto->set_originator_cache_guid(originator_cache_guid_);
119 sync_entity->set_originator_client_item_id(originator_client_item_id_); 118 proto->set_originator_client_item_id(originator_client_item_id_);
120 119
121 sync_entity->set_parent_id_string(parent_id_); 120 proto->set_parent_id_string(parent_id_);
122 sync_entity->set_ctime(creation_time_); 121 proto->set_ctime(creation_time_);
123 sync_entity->set_mtime(last_modified_time_); 122 proto->set_mtime(last_modified_time_);
124 123
125 sync_pb::UniquePosition* unique_position = 124 sync_pb::UniquePosition* unique_position = proto->mutable_unique_position();
126 sync_entity->mutable_unique_position();
127 unique_position->CopyFrom(unique_position_); 125 unique_position->CopyFrom(unique_position_);
128
129 return sync_entity;
130 } 126 }
131 127
132 bool BookmarkEntity::IsDeleted() const { 128 bool BookmarkEntity::IsDeleted() const {
133 return false; 129 return false;
134 } 130 }
135 131
136 bool BookmarkEntity::IsFolder() const { 132 bool BookmarkEntity::IsFolder() const {
137 return is_folder_; 133 return is_folder_;
138 } 134 }
139 135
140 } // namespace fake_server 136 } // namespace fake_server
OLDNEW
« no previous file with comments | « sync/test/fake_server/bookmark_entity.h ('k') | sync/test/fake_server/fake_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698