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

Unified Diff: sync/api/attachments/fake_attachment_service.cc

Issue 264793007: Keep track of which attachments are referenced by which sync entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix memory leak. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/api/attachments/fake_attachment_service.h ('k') | sync/api/sync_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/api/attachments/fake_attachment_service.cc
diff --git a/sync/api/attachments/fake_attachment_service.cc b/sync/api/attachments/fake_attachment_service.cc
index b9eb88ec928ad9f2f15233b5749890f7aa647deb..5cb01e5d1ba3ec01b7968e4a514db4cab785ba49 100644
--- a/sync/api/attachments/fake_attachment_service.cc
+++ b/sync/api/attachments/fake_attachment_service.cc
@@ -51,10 +51,15 @@ void FakeAttachmentService::DropAttachments(
callback));
}
-void FakeAttachmentService::OnSyncDataAdd(const SyncData& sync_data) {
+void FakeAttachmentService::StoreAttachments(const AttachmentList& attachments,
+ const StoreCallback& callback) {
DCHECK(CalledOnValidThread());
- // TODO(maniscalco): Ensure the linked attachments get persisted in local
- // storage and schedule them for upload to the server (bug 356351).
+ attachment_store_->Write(attachments,
+ base::Bind(&FakeAttachmentService::WriteDone,
+ weak_ptr_factory_.GetWeakPtr(),
+ callback));
+ // TODO(maniscalco): Ensure the linked attachments are schedule for upload to
+ // the server (bug 356351).
}
void FakeAttachmentService::OnSyncDataDelete(const SyncData& sync_data) {
@@ -99,4 +104,16 @@ void FakeAttachmentService::DropDone(const DropCallback& callback,
base::Bind(callback, drop_result));
}
+void FakeAttachmentService::WriteDone(const StoreCallback& callback,
+ const AttachmentStore::Result& result) {
+ AttachmentService::StoreResult store_result =
+ AttachmentService::STORE_UNSPECIFIED_ERROR;
+ if (result == AttachmentStore::SUCCESS) {
+ store_result = AttachmentService::STORE_SUCCESS;
+ }
+ // TODO(maniscalco): Deal with case where an error occurred (bug 361251).
+ base::MessageLoop::current()->PostTask(FROM_HERE,
+ base::Bind(callback, store_result));
+}
+
} // namespace syncer
« no previous file with comments | « sync/api/attachments/fake_attachment_service.h ('k') | sync/api/sync_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698