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

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

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

Powered by Google App Engine
This is Rietveld 408576698