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

Side by Side Diff: mojo/common/data_pipe_drainer.cc

Issue 1538823002: Convert Pass()→std::move() in mojo/ (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
« no previous file with comments | « mojo/common/common_type_converters.cc ('k') | mojo/common/data_pipe_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "mojo/common/data_pipe_drainer.h" 5 #include "mojo/common/data_pipe_drainer.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 10
9 namespace mojo { 11 namespace mojo {
10 namespace common { 12 namespace common {
11 13
12 DataPipeDrainer::DataPipeDrainer(Client* client, 14 DataPipeDrainer::DataPipeDrainer(Client* client,
13 mojo::ScopedDataPipeConsumerHandle source) 15 mojo::ScopedDataPipeConsumerHandle source)
14 : client_(client), source_(source.Pass()), weak_factory_(this) { 16 : client_(client), source_(std::move(source)), weak_factory_(this) {
15 DCHECK(client_); 17 DCHECK(client_);
16 ReadData(); 18 ReadData();
17 } 19 }
18 20
19 DataPipeDrainer::~DataPipeDrainer() {} 21 DataPipeDrainer::~DataPipeDrainer() {}
20 22
21 void DataPipeDrainer::ReadData() { 23 void DataPipeDrainer::ReadData() {
22 const void* buffer = nullptr; 24 const void* buffer = nullptr;
23 uint32_t num_bytes = 0; 25 uint32_t num_bytes = 0;
24 MojoResult rv = BeginReadDataRaw(source_.get(), &buffer, &num_bytes, 26 MojoResult rv = BeginReadDataRaw(source_.get(), &buffer, &num_bytes,
(...skipping 16 matching lines...) Expand all
41 source_.get(), MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, 43 source_.get(), MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE,
42 base::Bind(&DataPipeDrainer::WaitComplete, weak_factory_.GetWeakPtr())); 44 base::Bind(&DataPipeDrainer::WaitComplete, weak_factory_.GetWeakPtr()));
43 } 45 }
44 46
45 void DataPipeDrainer::WaitComplete(MojoResult result) { 47 void DataPipeDrainer::WaitComplete(MojoResult result) {
46 ReadData(); 48 ReadData();
47 } 49 }
48 50
49 } // namespace common 51 } // namespace common
50 } // namespace mojo 52 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/common/common_type_converters.cc ('k') | mojo/common/data_pipe_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698