OLD | NEW |
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/api/attachments/attachment_service_impl.h" | 5 #include "sync/internal_api/public/attachments/attachment_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "sync/api/attachments/attachment.h" | 10 #include "sync/api/attachments/attachment.h" |
| 11 #include "sync/api/attachments/fake_attachment_store.h" |
11 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" | 12 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" |
12 #include "sync/internal_api/public/attachments/fake_attachment_store.h" | |
13 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" | 13 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" |
14 | 14 |
15 namespace syncer { | 15 namespace syncer { |
16 | 16 |
17 // GetOrDownloadAttachments starts multiple parallel DownloadAttachment calls. | 17 // GetOrDownloadAttachments starts multiple parallel DownloadAttachment calls. |
18 // GetOrDownloadState tracks completion of these calls and posts callback for | 18 // GetOrDownloadState tracks completion of these calls and posts callback for |
19 // consumer once all attachments are either retrieved or reported unavailable. | 19 // consumer once all attachments are either retrieved or reported unavailable. |
20 class AttachmentServiceImpl::GetOrDownloadState | 20 class AttachmentServiceImpl::GetOrDownloadState |
21 : public base::RefCounted<GetOrDownloadState>, | 21 : public base::RefCounted<GetOrDownloadState>, |
22 public base::NonThreadSafe { | 22 public base::NonThreadSafe { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 const AttachmentDownloader::DownloadResult& result, | 255 const AttachmentDownloader::DownloadResult& result, |
256 scoped_ptr<Attachment> attachment) { | 256 scoped_ptr<Attachment> attachment) { |
257 if (result == AttachmentDownloader::DOWNLOAD_SUCCESS) { | 257 if (result == AttachmentDownloader::DOWNLOAD_SUCCESS) { |
258 state->AddAttachment(*attachment.get()); | 258 state->AddAttachment(*attachment.get()); |
259 } else { | 259 } else { |
260 state->AddUnavailableAttachmentId(attachment_id); | 260 state->AddUnavailableAttachmentId(attachment_id); |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
264 } // namespace syncer | 264 } // namespace syncer |
OLD | NEW |