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

Unified Diff: mojo/edk/system/local_message_pipe_endpoint.cc

Issue 1959523002: EDK: Plumb Handle/HandleVector one more layer down. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.h ('k') | mojo/edk/system/message_pipe.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/local_message_pipe_endpoint.cc
diff --git a/mojo/edk/system/local_message_pipe_endpoint.cc b/mojo/edk/system/local_message_pipe_endpoint.cc
index 43d11e1258a93d1a0023b0076295155c1acedc1b..b8a75ac59ab66d0c4b2e657f0f2623f49cf21f28 100644
--- a/mojo/edk/system/local_message_pipe_endpoint.cc
+++ b/mojo/edk/system/local_message_pipe_endpoint.cc
@@ -70,14 +70,14 @@ void LocalMessagePipeEndpoint::CancelAllAwakables() {
MojoResult LocalMessagePipeEndpoint::ReadMessage(
UserPointer<void> bytes,
UserPointer<uint32_t> num_bytes,
- DispatcherVector* dispatchers,
- uint32_t* num_dispatchers,
+ HandleVector* handles,
+ uint32_t* num_handles,
MojoReadMessageFlags flags) {
DCHECK(is_open_);
- DCHECK(!dispatchers || dispatchers->empty());
+ DCHECK(!handles || handles->empty());
const uint32_t max_bytes = num_bytes.IsNull() ? 0 : num_bytes.Get();
- const uint32_t max_num_dispatchers = num_dispatchers ? *num_dispatchers : 0;
+ const uint32_t max_num_handles = num_handles ? *num_handles : 0;
if (message_queue_.IsEmpty()) {
return is_peer_open_ ? MOJO_RESULT_SHOULD_WAIT
@@ -96,21 +96,30 @@ MojoResult LocalMessagePipeEndpoint::ReadMessage(
enough_space = false;
if (DispatcherVector* queued_dispatchers = message->dispatchers()) {
- if (num_dispatchers)
- *num_dispatchers = static_cast<uint32_t>(queued_dispatchers->size());
+ if (num_handles)
+ *num_handles = static_cast<uint32_t>(queued_dispatchers->size());
if (enough_space) {
if (queued_dispatchers->empty()) {
// Nothing to do.
- } else if (queued_dispatchers->size() <= max_num_dispatchers) {
- DCHECK(dispatchers);
- dispatchers->swap(*queued_dispatchers);
+ } else if (queued_dispatchers->size() <= max_num_handles) {
+ DCHECK(handles);
+ // TODO(vtl): The rest of this code in this block is temporary, until I
+ // plumb |Handle|s into |MessageInTransit|. This should really just be
+ // something like:
+ // handles->swap(*queued_handles);
+ handles->reserve(queued_dispatchers->size());
+ for (size_t i = 0; i < queued_dispatchers->size(); i++) {
+ // We're not enforcing handle rights yet, so "none" is OK.
+ handles->push_back(Handle(std::move(queued_dispatchers->at(i)),
+ MOJO_HANDLE_RIGHT_NONE));
+ }
} else {
enough_space = false;
}
}
} else {
- if (num_dispatchers)
- *num_dispatchers = 0;
+ if (num_handles)
+ *num_handles = 0;
}
message = nullptr;
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.h ('k') | mojo/edk/system/message_pipe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698