OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "core/mojo/Mojo.h" |
| 6 |
| 7 #include "core/mojo/MojoCreateMessagePipeResult.h" |
| 8 #include "core/mojo/MojoHandle.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 // static |
| 13 void Mojo::createMessagePipe(MojoCreateMessagePipeResult& resultDict) { |
| 14 MojoCreateMessagePipeOptions options = {0}; |
| 15 options.struct_size = sizeof(::MojoCreateMessagePipeOptions); |
| 16 options.flags = MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE; |
| 17 |
| 18 mojo::ScopedMessagePipeHandle handle0, handle1; |
| 19 MojoResult result = mojo::CreateMessagePipe(&options, &handle0, &handle1); |
| 20 |
| 21 resultDict.setResult(result); |
| 22 if (result == MOJO_RESULT_OK) { |
| 23 resultDict.setHandle0( |
| 24 MojoHandle::create(mojo::ScopedHandle::From(std::move(handle0)))); |
| 25 resultDict.setHandle1( |
| 26 MojoHandle::create(mojo::ScopedHandle::From(std::move(handle1)))); |
| 27 } |
| 28 } |
| 29 |
| 30 } // namespace blink |
OLD | NEW |