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

Side by Side Diff: ipc/mojo/ipc_message_pipe_reader.cc

Issue 1550693002: Global conversion of Pass()→std::move() on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | ipc/mojo/ipc_mojo_bootstrap.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 "ipc/mojo/ipc_message_pipe_reader.h" 5 #include "ipc/mojo/ipc_message_pipe_reader.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
11 #include "base/location.h" 12 #include "base/location.h"
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
15 #include "ipc/mojo/async_handle_waiter.h" 16 #include "ipc/mojo/async_handle_waiter.h"
16 #include "ipc/mojo/ipc_channel_mojo.h" 17 #include "ipc/mojo/ipc_channel_mojo.h"
17 18
18 namespace IPC { 19 namespace IPC {
19 namespace internal { 20 namespace internal {
20 21
21 MessagePipeReader::MessagePipeReader(mojo::ScopedMessagePipeHandle handle, 22 MessagePipeReader::MessagePipeReader(mojo::ScopedMessagePipeHandle handle,
22 MessagePipeReader::Delegate* delegate) 23 MessagePipeReader::Delegate* delegate)
23 : pipe_(handle.Pass()), 24 : pipe_(std::move(handle)),
24 handle_copy_(pipe_.get().value()), 25 handle_copy_(pipe_.get().value()),
25 delegate_(delegate), 26 delegate_(delegate),
26 async_waiter_( 27 async_waiter_(new AsyncHandleWaiter(
27 new AsyncHandleWaiter(base::Bind(&MessagePipeReader::PipeIsReady, 28 base::Bind(&MessagePipeReader::PipeIsReady, base::Unretained(this)))),
28 base::Unretained(this)))), 29 pending_send_error_(MOJO_RESULT_OK) {}
29 pending_send_error_(MOJO_RESULT_OK) {
30 }
31 30
32 MessagePipeReader::~MessagePipeReader() { 31 MessagePipeReader::~MessagePipeReader() {
33 DCHECK(thread_checker_.CalledOnValidThread()); 32 DCHECK(thread_checker_.CalledOnValidThread());
34 // The pipe should be closed before deletion. 33 // The pipe should be closed before deletion.
35 CHECK(!IsValid()); 34 CHECK(!IsValid());
36 } 35 }
37 36
38 void MessagePipeReader::Close() { 37 void MessagePipeReader::Close() {
39 DCHECK(thread_checker_.CalledOnValidThread()); 38 DCHECK(thread_checker_.CalledOnValidThread());
40 async_waiter_.reset(); 39 async_waiter_.reset();
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 235
237 void MessagePipeReader::DelayedDeleter::operator()( 236 void MessagePipeReader::DelayedDeleter::operator()(
238 MessagePipeReader* ptr) const { 237 MessagePipeReader* ptr) const {
239 ptr->Close(); 238 ptr->Close();
240 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, 239 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
241 base::Bind(&DeleteNow, ptr)); 240 base::Bind(&DeleteNow, ptr));
242 } 241 }
243 242
244 } // namespace internal 243 } // namespace internal
245 } // namespace IPC 244 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/mojo/ipc_channel_mojo_unittest.cc ('k') | ipc/mojo/ipc_mojo_bootstrap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698