summaryrefslogtreecommitdiff
path: root/mojo/edk/system/data_pipe_control_message.cc
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2018-04-24 01:37:19 +0900
committerHidehiko Abe <hidehiko@google.com>2018-04-24 03:09:01 +0900
commitb268b43ac6fdbc4f3a2ed1429b99ace424906090 (patch)
treebd2d04362f66c36d4279f7a9735ba21ea3a2a021 /mojo/edk/system/data_pipe_control_message.cc
parent4a54b98aa445f521c6945e4f4a1e0ea788fa7da8 (diff)
downloadlibchrome-b268b43ac6fdbc4f3a2ed1429b99ace424906090.tar.gz
Migrate libmojo repository into libchrome, part 2.
This CL moves following files. - .gitignore - Android.bp is merged into libchrome's Android.bp. - base/android/* - build/* except build_config.h which is exactly same with libchrome's. - ipc/* - mojo/* except mojo/public/tools/bindings/generators/__init__.py which is unused and not in chrome repository. - soong/* into libchrome_tools/ - third_party/{catapult,jinja2,markupsafe,ply}/* - ui/gfx/{geometry,range}/mojo/* Then, update several paths/build rules to be adapted. Bug: 73606903 Test: Built locally. Ran on DUT. Change-Id: I2a532a42aa68dcb215dbd71d8673192311509726
Diffstat (limited to 'mojo/edk/system/data_pipe_control_message.cc')
-rw-r--r--mojo/edk/system/data_pipe_control_message.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/mojo/edk/system/data_pipe_control_message.cc b/mojo/edk/system/data_pipe_control_message.cc
new file mode 100644
index 0000000000..23873b8290
--- /dev/null
+++ b/mojo/edk/system/data_pipe_control_message.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/data_pipe_control_message.h"
+
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/system/node_controller.h"
+#include "mojo/edk/system/ports_message.h"
+
+namespace mojo {
+namespace edk {
+
+void SendDataPipeControlMessage(NodeController* node_controller,
+ const ports::PortRef& port,
+ DataPipeCommand command,
+ uint32_t num_bytes) {
+ std::unique_ptr<PortsMessage> message =
+ PortsMessage::NewUserMessage(sizeof(DataPipeControlMessage), 0, 0);
+ CHECK(message);
+
+ DataPipeControlMessage* data =
+ static_cast<DataPipeControlMessage*>(message->mutable_payload_bytes());
+ data->command = command;
+ data->num_bytes = num_bytes;
+
+ int rv = node_controller->SendMessage(port, std::move(message));
+ if (rv != ports::OK && rv != ports::ERROR_PORT_PEER_CLOSED) {
+ DLOG(ERROR) << "Unexpected failure sending data pipe control message: "
+ << rv;
+ }
+}
+
+} // namespace edk
+} // namespace mojo