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

Side by Side Diff: sync/api/sync_data.cc

Issue 247983002: Keep track of which attachments are referenced by which sync entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix "copy yourself bug". Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/api/sync_data.h" 5 #include "sync/api/sync_data.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 const sync_pb::EntitySpecifics& specifics, 106 const sync_pb::EntitySpecifics& specifics,
107 const AttachmentList& attachments) { 107 const AttachmentList& attachments) {
108 sync_pb::SyncEntity entity; 108 sync_pb::SyncEntity entity;
109 entity.set_client_defined_unique_tag(sync_tag); 109 entity.set_client_defined_unique_tag(sync_tag);
110 entity.set_non_unique_name(non_unique_title); 110 entity.set_non_unique_name(non_unique_title);
111 entity.mutable_specifics()->CopyFrom(specifics); 111 entity.mutable_specifics()->CopyFrom(specifics);
112 std::transform(attachments.begin(), 112 std::transform(attachments.begin(),
113 attachments.end(), 113 attachments.end(),
114 RepeatedFieldBackInserter(entity.mutable_attachment_id()), 114 RepeatedFieldBackInserter(entity.mutable_attachment_id()),
115 AttachmentToProto); 115 AttachmentToProto);
116 // TODO(maniscalco): Actually pass the attachments to the ctor and make them
117 // available to the AttachmentService once this SyncData gets passed into
118 // GenericChangeProcesso::ProcessSyncChanges (bug 354530).
119 AttachmentList copy_of_attachments(attachments); 116 AttachmentList copy_of_attachments(attachments);
120 return SyncData(kInvalidId, 117 return SyncData(kInvalidId,
121 &entity, 118 &entity,
122 &copy_of_attachments, 119 &copy_of_attachments,
123 base::Time(), 120 base::Time(),
124 AttachmentServiceProxy()); 121 AttachmentServiceProxy());
125 } 122 }
126 123
127 // Static. 124 // Static.
128 SyncData SyncData::CreateRemoteData( 125 SyncData SyncData::CreateRemoteData(
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 attachment_service_.GetOrDownloadAttachments(attachment_ids, callback); 231 attachment_service_.GetOrDownloadAttachments(attachment_ids, callback);
235 } 232 }
236 233
237 void SyncDataRemote::DropAttachments( 234 void SyncDataRemote::DropAttachments(
238 const AttachmentIdList& attachment_ids, 235 const AttachmentIdList& attachment_ids,
239 const AttachmentService::DropCallback& callback) { 236 const AttachmentService::DropCallback& callback) {
240 attachment_service_.DropAttachments(attachment_ids, callback); 237 attachment_service_.DropAttachments(attachment_ids, callback);
241 } 238 }
242 239
243 } // namespace syncer 240 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698