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

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

Issue 2422253002: [Sync] Rewriting ".reset(new" pattern to use "= base::MakeUnique" instead. (Closed)
Patch Set: Fixing compile. Created 4 years, 2 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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
11 #include "components/sync/engine/attachments/attachment_util.h" 14 #include "components/sync/engine/attachments/attachment_util.h"
12 15
13 namespace syncer { 16 namespace syncer {
14 17
15 FakeAttachmentDownloader::FakeAttachmentDownloader() {} 18 FakeAttachmentDownloader::FakeAttachmentDownloader() {}
16 19
17 FakeAttachmentDownloader::~FakeAttachmentDownloader() { 20 FakeAttachmentDownloader::~FakeAttachmentDownloader() {
18 DCHECK(CalledOnValidThread()); 21 DCHECK(CalledOnValidThread());
19 } 22 }
20 23
21 void FakeAttachmentDownloader::DownloadAttachment( 24 void FakeAttachmentDownloader::DownloadAttachment(
22 const AttachmentId& attachment_id, 25 const AttachmentId& attachment_id,
23 const DownloadCallback& callback) { 26 const DownloadCallback& callback) {
24 DCHECK(CalledOnValidThread()); 27 DCHECK(CalledOnValidThread());
25 // This is happy fake downloader, it always successfully downloads empty 28 // This is happy fake downloader, it always successfully downloads empty
26 // attachment. 29 // attachment.
27 scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes()); 30 scoped_refptr<base::RefCountedMemory> data(new base::RefCountedBytes());
28 std::unique_ptr<Attachment> attachment; 31 std::unique_ptr<Attachment> attachment = base::MakeUnique<Attachment>(
29 attachment.reset( 32 Attachment::CreateFromParts(attachment_id, data));
30 new Attachment(Attachment::CreateFromParts(attachment_id, data)));
31 base::ThreadTaskRunnerHandle::Get()->PostTask( 33 base::ThreadTaskRunnerHandle::Get()->PostTask(
32 FROM_HERE, 34 FROM_HERE,
33 base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment))); 35 base::Bind(callback, DOWNLOAD_SUCCESS, base::Passed(&attachment)));
34 } 36 }
35 37
36 } // namespace syncer 38 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/driver/startup_controller_unittest.cc ('k') | components/sync/engine/attachments/on_disk_attachment_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698