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

Unified Diff: third_party/WebKit/Source/core/mojo/Mojo.cpp

Issue 2400563002: Adds Mojo IDL. (Closed)
Patch Set: addressed comments Created 3 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698