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

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

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/edk/system/data_pipe_control_message.h"
6
7 #include "mojo/edk/embedder/platform_handle_vector.h"
8 #include "mojo/edk/system/node_controller.h"
9 #include "mojo/edk/system/ports_message.h"
10
11 namespace mojo {
12 namespace edk {
13
14 void SendDataPipeControlMessage(NodeController* node_controller,
15 const ports::PortRef& port,
16 DataPipeCommand command,
17 uint32_t num_bytes) {
18 scoped_ptr<PortsMessage> message =
19 PortsMessage::NewUserMessage(sizeof(DataPipeControlMessage), 0, 0);
20 CHECK(message);
21
22 DataPipeControlMessage* data =
23 static_cast<DataPipeControlMessage*>(message->mutable_payload_bytes());
24 data->command = command;
25 data->num_bytes = num_bytes;
26
27 int rv = node_controller->SendMessage(port, &message);
28 if (rv != ports::OK && rv != ports::ERROR_PORT_PEER_CLOSED) {
29 DLOG(ERROR) << "Unexpected failure sending data pipe control message: "
30 << rv;
31 }
32 }
33
34 } // namespace edk
35 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698