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

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

Issue 2084593005: Rationalize AddAwakable...() and RemoveAwakable...() methods. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: doh 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/message_pipe.h ('k') | mojo/edk/system/message_pipe_dispatcher.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/message_pipe.h" 5 #include "mojo/edk/system/message_pipe.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 DCHECK(port == 0 || port == 1); 184 DCHECK(port == 0 || port == 1);
185 185
186 MutexLocker locker(&mutex_); 186 MutexLocker locker(&mutex_);
187 DCHECK(endpoints_[port]); 187 DCHECK(endpoints_[port]);
188 188
189 return endpoints_[port]->GetHandleSignalsState(); 189 return endpoints_[port]->GetHandleSignalsState();
190 } 190 }
191 191
192 MojoResult MessagePipe::AddAwakable(unsigned port, 192 MojoResult MessagePipe::AddAwakable(unsigned port,
193 Awakable* awakable, 193 Awakable* awakable,
194 uint64_t context,
195 bool force,
194 MojoHandleSignals signals, 196 MojoHandleSignals signals,
195 bool force,
196 uint64_t context,
197 HandleSignalsState* signals_state) { 197 HandleSignalsState* signals_state) {
198 DCHECK(port == 0 || port == 1); 198 DCHECK(port == 0 || port == 1);
199 199
200 MutexLocker locker(&mutex_); 200 MutexLocker locker(&mutex_);
201 DCHECK(endpoints_[port]); 201 DCHECK(endpoints_[port]);
202 202
203 return endpoints_[port]->AddAwakable(awakable, signals, force, context, 203 return endpoints_[port]->AddAwakable(awakable, context, force, signals,
204 signals_state); 204 signals_state);
205 } 205 }
206 206
207 void MessagePipe::RemoveAwakable(unsigned port, 207 void MessagePipe::RemoveAwakable(unsigned port,
208 bool match_context,
208 Awakable* awakable, 209 Awakable* awakable,
210 uint64_t context,
209 HandleSignalsState* signals_state) { 211 HandleSignalsState* signals_state) {
210 DCHECK(port == 0 || port == 1); 212 DCHECK(port == 0 || port == 1);
211 213
212 MutexLocker locker(&mutex_); 214 MutexLocker locker(&mutex_);
213 DCHECK(endpoints_[port]); 215 DCHECK(endpoints_[port]);
214 216
215 endpoints_[port]->RemoveAwakable(awakable, signals_state); 217 endpoints_[port]->RemoveAwakable(match_context, awakable, context,
216 } 218 signals_state);
217
218 void MessagePipe::RemoveAwakableWithContext(unsigned port,
219 Awakable* awakable,
220 uint64_t context,
221 HandleSignalsState* signals_state) {
222 DCHECK(port == 0 || port == 1);
223
224 MutexLocker locker(&mutex_);
225 DCHECK(endpoints_[port]);
226
227 endpoints_[port]->RemoveAwakableWithContext(awakable, context, signals_state);
228 } 219 }
229 220
230 void MessagePipe::StartSerialize(unsigned /*port*/, 221 void MessagePipe::StartSerialize(unsigned /*port*/,
231 Channel* channel, 222 Channel* channel,
232 size_t* max_size, 223 size_t* max_size,
233 size_t* max_platform_handles) { 224 size_t* max_platform_handles) {
234 *max_size = channel->GetSerializedEndpointSize(); 225 *max_size = channel->GetSerializedEndpointSize();
235 *max_platform_handles = 0; 226 *max_platform_handles = 0;
236 } 227 }
237 228
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 LOG(WARNING) << "Enqueueing null dispatcher"; 374 LOG(WARNING) << "Enqueueing null dispatcher";
384 handles->push_back(Handle()); 375 handles->push_back(Handle());
385 } 376 }
386 } 377 }
387 message->SetHandles(std::move(handles)); 378 message->SetHandles(std::move(handles));
388 return MOJO_RESULT_OK; 379 return MOJO_RESULT_OK;
389 } 380 }
390 381
391 } // namespace system 382 } // namespace system
392 } // namespace mojo 383 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe.h ('k') | mojo/edk/system/message_pipe_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698