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

Side by Side Diff: mojo/edk/system/data_pipe_consumer_dispatcher.cc

Issue 1943123002: Make it possible to write a message pipe endpoint's peer into it. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/edk/system/data_pipe_consumer_dispatcher.h" 5 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/edk/system/data_pipe.h" 10 #include "mojo/edk/system/data_pipe.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 data_pipe_->ConsumerCancelAllAwakables(); 65 data_pipe_->ConsumerCancelAllAwakables();
66 } 66 }
67 67
68 void DataPipeConsumerDispatcher::CloseImplNoLock() { 68 void DataPipeConsumerDispatcher::CloseImplNoLock() {
69 mutex().AssertHeld(); 69 mutex().AssertHeld();
70 data_pipe_->ConsumerClose(); 70 data_pipe_->ConsumerClose();
71 data_pipe_ = nullptr; 71 data_pipe_ = nullptr;
72 } 72 }
73 73
74 RefPtr<Dispatcher> 74 RefPtr<Dispatcher>
75 DataPipeConsumerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { 75 DataPipeConsumerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock(
76 MessagePipe* /*message_pipe*/,
77 unsigned /*port*/) {
76 mutex().AssertHeld(); 78 mutex().AssertHeld();
77 79
80 CancelAllAwakablesNoLock();
81
78 auto dispatcher = DataPipeConsumerDispatcher::Create(); 82 auto dispatcher = DataPipeConsumerDispatcher::Create();
79 dispatcher->Init(std::move(data_pipe_)); 83 dispatcher->Init(std::move(data_pipe_));
80 return dispatcher; 84 return dispatcher;
81 } 85 }
82 86
83 MojoResult DataPipeConsumerDispatcher::SetDataPipeConsumerOptionsImplNoLock( 87 MojoResult DataPipeConsumerDispatcher::SetDataPipeConsumerOptionsImplNoLock(
84 UserPointer<const MojoDataPipeConsumerOptions> options) { 88 UserPointer<const MojoDataPipeConsumerOptions> options) {
85 mutex().AssertHeld(); 89 mutex().AssertHeld();
86 90
87 // The default of 0 means 1 element (however big that is). 91 // The default of 0 means 1 element (however big that is).
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return rv; 226 return rv;
223 } 227 }
224 228
225 bool DataPipeConsumerDispatcher::IsBusyNoLock() const { 229 bool DataPipeConsumerDispatcher::IsBusyNoLock() const {
226 mutex().AssertHeld(); 230 mutex().AssertHeld();
227 return data_pipe_->ConsumerIsBusy(); 231 return data_pipe_->ConsumerIsBusy();
228 } 232 }
229 233
230 } // namespace system 234 } // namespace system
231 } // namespace mojo 235 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698