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

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

Issue 1866243002: Convert //sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/attachment_store_frontend.h" 5 #include "sync/internal_api/public/attachments/attachment_store_frontend.h"
6 6
7 #include <utility> 7 #include <utility>
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/sequenced_task_runner.h" 11 #include "base/sequenced_task_runner.h"
12 #include "sync/api/attachments/attachment.h" 12 #include "sync/api/attachments/attachment.h"
13 #include "sync/api/attachments/attachment_store_backend.h" 13 #include "sync/api/attachments/attachment_store_backend.h"
14 14
15 namespace syncer { 15 namespace syncer {
16 16
17 namespace { 17 namespace {
18 18
19 // NoOp is needed to bind base::Passed(backend) in AttachmentStoreFrontend dtor. 19 // NoOp is needed to bind base::Passed(backend) in AttachmentStoreFrontend dtor.
20 // It doesn't need to do anything. 20 // It doesn't need to do anything.
21 void NoOp(scoped_ptr<AttachmentStoreBackend> backend) { 21 void NoOp(std::unique_ptr<AttachmentStoreBackend> backend) {}
22 }
23 22
24 } // namespace 23 } // namespace
25 24
26 AttachmentStoreFrontend::AttachmentStoreFrontend( 25 AttachmentStoreFrontend::AttachmentStoreFrontend(
27 scoped_ptr<AttachmentStoreBackend> backend, 26 std::unique_ptr<AttachmentStoreBackend> backend,
28 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner) 27 const scoped_refptr<base::SequencedTaskRunner>& backend_task_runner)
29 : backend_(std::move(backend)), backend_task_runner_(backend_task_runner) { 28 : backend_(std::move(backend)), backend_task_runner_(backend_task_runner) {
30 DCHECK(backend_); 29 DCHECK(backend_);
31 DCHECK(backend_task_runner_.get()); 30 DCHECK(backend_task_runner_.get());
32 } 31 }
33 32
34 AttachmentStoreFrontend::~AttachmentStoreFrontend() { 33 AttachmentStoreFrontend::~AttachmentStoreFrontend() {
35 DCHECK(backend_); 34 DCHECK(backend_);
36 // To delete backend post task that doesn't do anything, but binds backend 35 // To delete backend post task that doesn't do anything, but binds backend
37 // through base::Passed. This way backend will be deleted regardless whether 36 // through base::Passed. This way backend will be deleted regardless whether
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 AttachmentStore::Component component, 103 AttachmentStore::Component component,
105 const AttachmentStore::ReadMetadataCallback& callback) { 104 const AttachmentStore::ReadMetadataCallback& callback) {
106 DCHECK(CalledOnValidThread()); 105 DCHECK(CalledOnValidThread());
107 backend_task_runner_->PostTask( 106 backend_task_runner_->PostTask(
108 FROM_HERE, 107 FROM_HERE,
109 base::Bind(&AttachmentStoreBackend::ReadMetadata, 108 base::Bind(&AttachmentStoreBackend::ReadMetadata,
110 base::Unretained(backend_.get()), component, callback)); 109 base::Unretained(backend_.get()), component, callback));
111 } 110 }
112 111
113 } // namespace syncer 112 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698