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

Side by Side Diff: sync/internal_api/attachments/fake_attachment_downloader.cc

Issue 2033933002: Remove use of deprecated MessageLoop methods in sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 #include "sync/internal_api/public/attachments/fake_attachment_downloader.h" 5 #include "sync/internal_api/public/attachments/fake_attachment_downloader.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/internal_api/public/attachments/attachment_util.h" 11 #include "sync/internal_api/public/attachments/attachment_util.h"
10 12
11 namespace syncer { 13 namespace syncer {
12 14
13 FakeAttachmentDownloader::FakeAttachmentDownloader() { 15 FakeAttachmentDownloader::FakeAttachmentDownloader() {
14 } 16 }
15 17
16 FakeAttachmentDownloader::~FakeAttachmentDownloader() { 18 FakeAttachmentDownloader::~FakeAttachmentDownloader() {
17 DCHECK(CalledOnValidThread()); 19 DCHECK(CalledOnValidThread());
18 } 20 }
19 21
20 void FakeAttachmentDownloader::DownloadAttachment( 22 void FakeAttachmentDownloader::DownloadAttachment(
21 const AttachmentId& attachment_id, 23 const AttachmentId& attachment_id,
22 const DownloadCallback& callback) { 24 const DownloadCallback& callback) {
23 DCHECK(CalledOnValidThread()); 25 DCHECK(CalledOnValidThread());
24 // This is happy fake downloader, it always successfully downloads empty 26 // This is happy fake downloader, it always successfully downloads empty
25 // attachment. 27 // attachment.
26 scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes()); 28 scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes());
27 std::unique_ptr<Attachment> attachment; 29 std::unique_ptr<Attachment> attachment;
28 attachment.reset( 30 attachment.reset(
29 new Attachment(Attachment::CreateFromParts(attachment_id, data))); 31 new Attachment(Attachment::CreateFromParts(attachment_id, data)));
30 base::MessageLoop::current()->PostTask( 32 base::ThreadTaskRunnerHandle::Get()->PostTask(
31 FROM_HERE, 33 FROM_HERE,
32 base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment))); 34 base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment)));
33 } 35 }
34 36
35 } // namespace syncer 37 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698