| 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 "components/sync/core/attachments/attachment_service_proxy.h" | 5 #include "components/sync/core/attachments/attachment_service_proxy.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/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 task_runner->PostTask( | 25 task_runner->PostTask( |
| 26 FROM_HERE, base::Bind(callback, result, base::Passed(&attachments))); | 26 FROM_HERE, base::Bind(callback, result, base::Passed(&attachments))); |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 AttachmentServiceProxy::AttachmentServiceProxy() {} | 31 AttachmentServiceProxy::AttachmentServiceProxy() {} |
| 32 | 32 |
| 33 AttachmentServiceProxy::AttachmentServiceProxy( | 33 AttachmentServiceProxy::AttachmentServiceProxy( |
| 34 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, | 34 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, |
| 35 const base::WeakPtr<syncer::AttachmentService>& wrapped) | 35 const base::WeakPtr<AttachmentService>& wrapped) |
| 36 : wrapped_task_runner_(wrapped_task_runner), core_(new Core(wrapped)) { | 36 : wrapped_task_runner_(wrapped_task_runner), core_(new Core(wrapped)) { |
| 37 DCHECK(wrapped_task_runner_.get()); | 37 DCHECK(wrapped_task_runner_.get()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 AttachmentServiceProxy::AttachmentServiceProxy( | 40 AttachmentServiceProxy::AttachmentServiceProxy( |
| 41 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, | 41 const scoped_refptr<base::SequencedTaskRunner>& wrapped_task_runner, |
| 42 const scoped_refptr<Core>& core) | 42 const scoped_refptr<Core>& core) |
| 43 : wrapped_task_runner_(wrapped_task_runner), core_(core) { | 43 : wrapped_task_runner_(wrapped_task_runner), core_(core) { |
| 44 DCHECK(wrapped_task_runner_.get()); | 44 DCHECK(wrapped_task_runner_.get()); |
| 45 DCHECK(core_.get()); | 45 DCHECK(core_.get()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 void AttachmentServiceProxy::UploadAttachments( | 65 void AttachmentServiceProxy::UploadAttachments( |
| 66 const AttachmentIdList& attachment_ids) { | 66 const AttachmentIdList& attachment_ids) { |
| 67 DCHECK(wrapped_task_runner_.get()); | 67 DCHECK(wrapped_task_runner_.get()); |
| 68 wrapped_task_runner_->PostTask( | 68 wrapped_task_runner_->PostTask( |
| 69 FROM_HERE, | 69 FROM_HERE, |
| 70 base::Bind(&AttachmentService::UploadAttachments, core_, attachment_ids)); | 70 base::Bind(&AttachmentService::UploadAttachments, core_, attachment_ids)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 AttachmentServiceProxy::Core::Core( | 73 AttachmentServiceProxy::Core::Core( |
| 74 const base::WeakPtr<syncer::AttachmentService>& wrapped) | 74 const base::WeakPtr<AttachmentService>& wrapped) |
| 75 : wrapped_(wrapped) {} | 75 : wrapped_(wrapped) {} |
| 76 | 76 |
| 77 AttachmentServiceProxy::Core::~Core() {} | 77 AttachmentServiceProxy::Core::~Core() {} |
| 78 | 78 |
| 79 void AttachmentServiceProxy::Core::GetOrDownloadAttachments( | 79 void AttachmentServiceProxy::Core::GetOrDownloadAttachments( |
| 80 const AttachmentIdList& attachment_ids, | 80 const AttachmentIdList& attachment_ids, |
| 81 const GetOrDownloadCallback& callback) { | 81 const GetOrDownloadCallback& callback) { |
| 82 if (!wrapped_) { | 82 if (!wrapped_) { |
| 83 return; | 83 return; |
| 84 } | 84 } |
| 85 wrapped_->GetOrDownloadAttachments(attachment_ids, callback); | 85 wrapped_->GetOrDownloadAttachments(attachment_ids, callback); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void AttachmentServiceProxy::Core::UploadAttachments( | 88 void AttachmentServiceProxy::Core::UploadAttachments( |
| 89 const AttachmentIdList& attachment_ids) { | 89 const AttachmentIdList& attachment_ids) { |
| 90 if (!wrapped_) { | 90 if (!wrapped_) { |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 wrapped_->UploadAttachments(attachment_ids); | 93 wrapped_->UploadAttachments(attachment_ids); |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace syncer | 96 } // namespace syncer |
| OLD | NEW |