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: components/sync_driver/generic_change_processor.h

Issue 567053002: Pass AttachmentIdList instead of AttachmentList to SyncData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Fix test. Apply feedback. 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 | « no previous file | components/sync_driver/generic_change_processor.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 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_
6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ 6 #define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 private: 110 private:
111 // Logically part of ProcessSyncChanges. 111 // Logically part of ProcessSyncChanges.
112 // 112 //
113 // |new_attachments| is an output parameter containing newly added attachments 113 // |new_attachments| is an output parameter containing newly added attachments
114 // that need to be stored. This method will append to it. 114 // that need to be stored. This method will append to it.
115 syncer::SyncError HandleActionAdd(const syncer::SyncChange& change, 115 syncer::SyncError HandleActionAdd(const syncer::SyncChange& change,
116 const std::string& type_str, 116 const std::string& type_str,
117 const syncer::ModelType& type, 117 const syncer::ModelType& type,
118 const syncer::WriteTransaction& trans, 118 const syncer::WriteTransaction& trans,
119 syncer::WriteNode* sync_node, 119 syncer::WriteNode* sync_node,
120 syncer::AttachmentList* new_attachments); 120 syncer::AttachmentIdList* new_attachments);
121 121
122 // Logically part of ProcessSyncChanges. 122 // Logically part of ProcessSyncChanges.
123 // 123 //
124 // |new_attachments| is an output parameter containing newly added attachments 124 // |new_attachments| is an output parameter containing newly added attachments
125 // that need to be stored. This method will append to it. 125 // that need to be stored. This method will append to it.
126 syncer::SyncError HandleActionUpdate(const syncer::SyncChange& change, 126 syncer::SyncError HandleActionUpdate(
127 const std::string& type_str, 127 const syncer::SyncChange& change,
128 const syncer::ModelType& type, 128 const std::string& type_str,
129 const syncer::WriteTransaction& trans, 129 const syncer::ModelType& type,
130 syncer::WriteNode* sync_node, 130 const syncer::WriteTransaction& trans,
131 syncer::AttachmentList* new_attachments); 131 syncer::WriteNode* sync_node,
132 syncer::AttachmentIdList* new_attachments);
132 133
133 // Store |attachments| locally then upload them to the sync server. 134 // Upload |attachments| to the sync server.
134 // 135 //
135 // Store and uploading are asynchronous operations. |WriteAttachmentsDone| 136 // This function assumes that attachments were already stored in
136 // will be invoked once the attachments have been stored on the local device. 137 // AttachmentStore.
137 void StoreAndUploadAttachments(const syncer::AttachmentList& attachments); 138 void UploadAttachments(const syncer::AttachmentIdList& attachment_ids);
138
139 // Invoked once attachments have been stored locally.
140 //
141 // See also AttachmentStore::WriteCallback.
142 void WriteAttachmentsDone(const syncer::AttachmentList& attachments,
143 const syncer::AttachmentStore::Result& result);
144 139
145 // The SyncableService this change processor will forward changes on to. 140 // The SyncableService this change processor will forward changes on to.
146 const base::WeakPtr<syncer::SyncableService> local_service_; 141 const base::WeakPtr<syncer::SyncableService> local_service_;
147 142
148 // A SyncMergeResult used to track the changes made during association. The 143 // A SyncMergeResult used to track the changes made during association. The
149 // owner will invalidate the weak pointer when association is complete. While 144 // owner will invalidate the weak pointer when association is complete. While
150 // the pointer is valid though, we increment it with any changes received 145 // the pointer is valid though, we increment it with any changes received
151 // via ProcessSyncChanges. 146 // via ProcessSyncChanges.
152 const base::WeakPtr<syncer::SyncMergeResult> merge_result_; 147 const base::WeakPtr<syncer::SyncMergeResult> merge_result_;
153 148
(...skipping 22 matching lines...) Expand all
176 scoped_ptr<syncer::AttachmentServiceProxy> attachment_service_proxy_; 171 scoped_ptr<syncer::AttachmentServiceProxy> attachment_service_proxy_;
177 172
178 base::WeakPtrFactory<GenericChangeProcessor> weak_ptr_factory_; 173 base::WeakPtrFactory<GenericChangeProcessor> weak_ptr_factory_;
179 174
180 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor); 175 DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessor);
181 }; 176 };
182 177
183 } // namespace sync_driver 178 } // namespace sync_driver
184 179
185 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_ 180 #endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_H_
OLDNEW
« no previous file with comments | « no previous file | components/sync_driver/generic_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698