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/internal_api/public/attachments/fake_attachment_uploader.h" | 5 #include "sync/internal_api/public/attachments/fake_attachment_uploader.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" |
9 #include "sync/api/attachments/attachment.h" | 11 #include "sync/api/attachments/attachment.h" |
10 #include "sync/protocol/sync.pb.h" | 12 #include "sync/protocol/sync.pb.h" |
11 | 13 |
12 namespace syncer { | 14 namespace syncer { |
13 | 15 |
14 FakeAttachmentUploader::FakeAttachmentUploader() { | 16 FakeAttachmentUploader::FakeAttachmentUploader() { |
15 DCHECK(CalledOnValidThread()); | 17 DCHECK(CalledOnValidThread()); |
16 } | 18 } |
17 | 19 |
18 FakeAttachmentUploader::~FakeAttachmentUploader() { | 20 FakeAttachmentUploader::~FakeAttachmentUploader() { |
19 DCHECK(CalledOnValidThread()); | 21 DCHECK(CalledOnValidThread()); |
20 } | 22 } |
21 | 23 |
22 void FakeAttachmentUploader::UploadAttachment(const Attachment& attachment, | 24 void FakeAttachmentUploader::UploadAttachment(const Attachment& attachment, |
23 const UploadCallback& callback) { | 25 const UploadCallback& callback) { |
24 DCHECK(CalledOnValidThread()); | 26 DCHECK(CalledOnValidThread()); |
25 DCHECK(!attachment.GetId().GetProto().unique_id().empty()); | 27 DCHECK(!attachment.GetId().GetProto().unique_id().empty()); |
26 | 28 |
27 UploadResult result = UPLOAD_SUCCESS; | 29 UploadResult result = UPLOAD_SUCCESS; |
28 AttachmentId id = attachment.GetId(); | 30 AttachmentId id = attachment.GetId(); |
29 base::MessageLoop::current()->PostTask(FROM_HERE, | 31 base::ThreadTaskRunnerHandle::Get()->PostTask( |
30 base::Bind(callback, result, id)); | 32 FROM_HERE, base::Bind(callback, result, id)); |
31 } | 33 } |
32 | 34 |
33 } // namespace syncer | 35 } // namespace syncer |
OLD | NEW |