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

Side by Side Diff: mojo/edk/system/message_pipe.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 unified diff | Download patch
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.cc ('k') | mojo/edk/system/message_pipe_endpoint.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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 UserPointer<void> bytes, 169 UserPointer<void> bytes,
170 UserPointer<uint32_t> num_bytes, 170 UserPointer<uint32_t> num_bytes,
171 HandleVector* handles, 171 HandleVector* handles,
172 uint32_t* num_handles, 172 uint32_t* num_handles,
173 MojoReadMessageFlags flags) { 173 MojoReadMessageFlags flags) {
174 DCHECK(port == 0 || port == 1); 174 DCHECK(port == 0 || port == 1);
175 175
176 MutexLocker locker(&mutex_); 176 MutexLocker locker(&mutex_);
177 DCHECK(endpoints_[port]); 177 DCHECK(endpoints_[port]);
178 178
179 // TODO(vtl): The code below is temporary scaffolding, until I can update the 179 return endpoints_[port]->ReadMessage(bytes, num_bytes, handles, num_handles,
180 // endpoint code. This should be just: 180 flags);
181 // return endpoints_[port]->ReadMessage(bytes, num_bytes, handles,
182 // num_handles, flags);
183 DispatcherVector dispatchers;
184 MojoResult rv = endpoints_[port]->ReadMessage(bytes, num_bytes, &dispatchers,
185 num_handles, flags);
186 for (size_t i = 0; i < dispatchers.size(); i++) {
187 // We're not enforcing handle rights yet, so "none" is OK.
188 handles->push_back(
189 Handle(std::move(dispatchers[i]), MOJO_HANDLE_RIGHT_NONE));
190 }
191 return rv;
192 } 181 }
193 182
194 HandleSignalsState MessagePipe::GetHandleSignalsState(unsigned port) const { 183 HandleSignalsState MessagePipe::GetHandleSignalsState(unsigned port) const {
195 DCHECK(port == 0 || port == 1); 184 DCHECK(port == 0 || port == 1);
196 185
197 MutexLocker locker(&mutex_); 186 MutexLocker locker(&mutex_);
198 DCHECK(endpoints_[port]); 187 DCHECK(endpoints_[port]);
199 188
200 return endpoints_[port]->GetHandleSignalsState(); 189 return endpoints_[port]->GetHandleSignalsState();
201 } 190 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 LOG(WARNING) << "Enqueueing null dispatcher"; 372 LOG(WARNING) << "Enqueueing null dispatcher";
384 dispatchers->push_back(nullptr); 373 dispatchers->push_back(nullptr);
385 } 374 }
386 } 375 }
387 message->SetDispatchers(std::move(dispatchers)); 376 message->SetDispatchers(std::move(dispatchers));
388 return MOJO_RESULT_OK; 377 return MOJO_RESULT_OK;
389 } 378 }
390 379
391 } // namespace system 380 } // namespace system
392 } // namespace mojo 381 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/local_message_pipe_endpoint.cc ('k') | mojo/edk/system/message_pipe_endpoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698