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

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

Issue 2068483002: Add an unconditional version of DispatcherAddAwakable(): AddAwakableUnconditional(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: oops Created 4 years, 6 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 | « mojo/edk/system/local_message_pipe_endpoint.h ('k') | mojo/edk/system/message_pipe.h » ('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 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/local_message_pipe_endpoint.h" 5 #include "mojo/edk/system/local_message_pipe_endpoint.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } else { 144 } else {
145 rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED; 145 rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
146 } 146 }
147 rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED; 147 rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
148 return rv; 148 return rv;
149 } 149 }
150 150
151 MojoResult LocalMessagePipeEndpoint::AddAwakable( 151 MojoResult LocalMessagePipeEndpoint::AddAwakable(
152 Awakable* awakable, 152 Awakable* awakable,
153 MojoHandleSignals signals, 153 MojoHandleSignals signals,
154 bool force,
154 uint64_t context, 155 uint64_t context,
155 HandleSignalsState* signals_state) { 156 HandleSignalsState* signals_state) {
156 DCHECK(is_open_); 157 DCHECK(is_open_);
157 158
158 HandleSignalsState state = GetHandleSignalsState(); 159 HandleSignalsState state = GetHandleSignalsState();
159 if (state.satisfies(signals)) { 160 if (state.satisfies(signals)) {
161 if (force)
162 awakable_list_.Add(awakable, signals, context);
160 if (signals_state) 163 if (signals_state)
161 *signals_state = state; 164 *signals_state = state;
162 return MOJO_RESULT_ALREADY_EXISTS; 165 return MOJO_RESULT_ALREADY_EXISTS;
163 } 166 }
164 if (!state.can_satisfy(signals)) { 167 if (!state.can_satisfy(signals)) {
165 if (signals_state) 168 if (signals_state)
166 *signals_state = state; 169 *signals_state = state;
167 return MOJO_RESULT_FAILED_PRECONDITION; 170 return MOJO_RESULT_FAILED_PRECONDITION;
168 } 171 }
169 172
170 awakable_list_.Add(awakable, signals, context); 173 awakable_list_.Add(awakable, signals, context);
171 return MOJO_RESULT_OK; 174 return MOJO_RESULT_OK;
172 } 175 }
173 176
174 void LocalMessagePipeEndpoint::RemoveAwakable( 177 void LocalMessagePipeEndpoint::RemoveAwakable(
175 Awakable* awakable, 178 Awakable* awakable,
176 HandleSignalsState* signals_state) { 179 HandleSignalsState* signals_state) {
177 DCHECK(is_open_); 180 DCHECK(is_open_);
178 awakable_list_.Remove(awakable); 181 awakable_list_.Remove(awakable);
179 if (signals_state) 182 if (signals_state)
180 *signals_state = GetHandleSignalsState(); 183 *signals_state = GetHandleSignalsState();
181 } 184 }
182 185
183 } // namespace system 186 } // namespace system
184 } // namespace mojo 187 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.h ('k') | mojo/edk/system/message_pipe.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698