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

Side by Side Diff: mojo/edk/system/data_pipe_producer_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_producer_dispatcher.h" 5 #include "mojo/edk/system/data_pipe_producer_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_->ProducerCancelAllAwakables(); 65 data_pipe_->ProducerCancelAllAwakables();
66 } 66 }
67 67
68 void DataPipeProducerDispatcher::CloseImplNoLock() { 68 void DataPipeProducerDispatcher::CloseImplNoLock() {
69 mutex().AssertHeld(); 69 mutex().AssertHeld();
70 data_pipe_->ProducerClose(); 70 data_pipe_->ProducerClose();
71 data_pipe_ = nullptr; 71 data_pipe_ = nullptr;
72 } 72 }
73 73
74 RefPtr<Dispatcher> 74 RefPtr<Dispatcher>
75 DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() { 75 DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock(
76 MessagePipe* /*message_pipe*/,
77 unsigned /*port*/) {
76 mutex().AssertHeld(); 78 mutex().AssertHeld();
77 79
80 CancelAllAwakablesNoLock();
81
78 auto dispatcher = DataPipeProducerDispatcher::Create(); 82 auto dispatcher = DataPipeProducerDispatcher::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 DataPipeProducerDispatcher::SetDataPipeProducerOptionsImplNoLock( 87 MojoResult DataPipeProducerDispatcher::SetDataPipeProducerOptionsImplNoLock(
84 UserPointer<const MojoDataPipeProducerOptions> options) { 88 UserPointer<const MojoDataPipeProducerOptions> 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return rv; 202 return rv;
199 } 203 }
200 204
201 bool DataPipeProducerDispatcher::IsBusyNoLock() const { 205 bool DataPipeProducerDispatcher::IsBusyNoLock() const {
202 mutex().AssertHeld(); 206 mutex().AssertHeld();
203 return data_pipe_->ProducerIsBusy(); 207 return data_pipe_->ProducerIsBusy();
204 } 208 }
205 209
206 } // namespace system 210 } // namespace system
207 } // namespace mojo 211 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698