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