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

Side by Side Diff: components/sync/engine/attachments/fake_attachment_downloader.cc

Issue 2915453002: Deprecate NonThreadSafe in components/sync in favor of SequenceChecker. (Closed)
Patch Set: fix comment Created 3 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 "components/sync/engine/attachments/fake_attachment_downloader.h" 5 #include "components/sync/engine/attachments/fake_attachment_downloader.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "components/sync/engine/attachments/attachment_util.h" 14 #include "components/sync/engine/attachments/attachment_util.h"
15 15
16 namespace syncer { 16 namespace syncer {
17 17
18 FakeAttachmentDownloader::FakeAttachmentDownloader() {} 18 FakeAttachmentDownloader::FakeAttachmentDownloader() {}
19 19
20 FakeAttachmentDownloader::~FakeAttachmentDownloader() { 20 FakeAttachmentDownloader::~FakeAttachmentDownloader() {
21 DCHECK(CalledOnValidThread()); 21 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
22 } 22 }
23 23
24 void FakeAttachmentDownloader::DownloadAttachment( 24 void FakeAttachmentDownloader::DownloadAttachment(
25 const AttachmentId& attachment_id, 25 const AttachmentId& attachment_id,
26 const DownloadCallback& callback) { 26 const DownloadCallback& callback) {
27 DCHECK(CalledOnValidThread()); 27 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
28 // This is happy fake downloader, it always successfully downloads empty 28 // This is happy fake downloader, it always successfully downloads empty
29 // attachment. 29 // attachment.
30 scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes()); 30 scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes());
31 std::unique_ptr<Attachment> attachment = base::MakeUnique<Attachment>( 31 std::unique_ptr<Attachment> attachment = base::MakeUnique<Attachment>(
32 Attachment::CreateFromParts(attachment_id, data)); 32 Attachment::CreateFromParts(attachment_id, data));
33 base::ThreadTaskRunnerHandle::Get()->PostTask( 33 base::ThreadTaskRunnerHandle::Get()->PostTask(
34 FROM_HERE, 34 FROM_HERE,
35 base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment))); 35 base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment)));
36 } 36 }
37 37
38 } // namespace syncer 38 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698