Index: third_party/WebKit/Source/core/mojo/Mojo.cpp |
diff --git a/third_party/WebKit/Source/core/mojo/Mojo.cpp b/third_party/WebKit/Source/core/mojo/Mojo.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2da7a73611e3c3b17612eca8aa29283c6f377eb2 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/mojo/Mojo.cpp |
@@ -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 "core/mojo/Mojo.h" |
+ |
+#include "core/mojo/MojoCreateMessagePipeOptions.h" |
+#include "core/mojo/MojoCreateMessagePipeResult.h" |
+#include "core/mojo/MojoHandle.h" |
+ |
+namespace blink { |
+ |
+Mojo* Mojo::create() { |
+ return new Mojo(); |
+} |
+ |
+void Mojo::createMessagePipe(const MojoCreateMessagePipeOptions& optionsDict, |
+ MojoCreateMessagePipeResult& resultDict) { |
+ ::MojoCreateMessagePipeOptions options = {0}; |
+ options.struct_size = sizeof(::MojoCreateMessagePipeOptions); |
+ options.flags = optionsDict.flags(); |
+ |
+ mojo::ScopedMessagePipeHandle handle0, handle1; |
+ MojoResult result = mojo::CreateMessagePipe(&options, &handle0, &handle1); |
+ |
+ resultDict.setResult(result); |
+ if (result == MOJO_RESULT_OK) { |
+ resultDict.setHandle0( |
+ MojoHandle::create(mojo::ScopedHandle::From(std::move(handle0)))); |
+ resultDict.setHandle1( |
+ MojoHandle::create(mojo::ScopedHandle::From(std::move(handle1)))); |
+ } |
+} |
+ |
+} // namespace blink |