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

Unified Diff: mojo/public/go/system/message_pipe.go

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « mojo/public/go/system/handle.go ('k') | mojo/public/go/system/mojo_types.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/go/system/message_pipe.go
diff --git a/mojo/public/go/system/message_pipe.go b/mojo/public/go/system/message_pipe.go
deleted file mode 100644
index 149b5becc1761a2f092043d23671e5e57ede2314..0000000000000000000000000000000000000000
--- a/mojo/public/go/system/message_pipe.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2015 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.
-
-package system
-
-// MessagePipeHandle is a handle for a bidirectional communication channel for
-// framed data (i.e., messages). Messages can contain plain data and/or Mojo
-// handles.
-type MessagePipeHandle interface {
- Handle
-
- // ReadMessage reads a message from the message pipe endpoint with the
- // specified flags. Returns the message data and attached handles that were
- // received in the "next" message.
- ReadMessage(flags MojoReadMessageFlags) (MojoResult, []byte, []UntypedHandle)
-
- // WriteMessage writes message data and optional attached handles to
- // the message pipe endpoint given by handle. On success the attached
- // handles will no longer be valid (i.e.: the receiver will receive
- // equivalent but logically different handles).
- WriteMessage(bytes []byte, handles []UntypedHandle, flags MojoWriteMessageFlags) MojoResult
-}
-
-type messagePipe struct {
- // baseHandle should always be the first component of this struct,
- // see |finalizeHandle()| for more details.
- baseHandle
-}
-
-func (h *messagePipe) ReadMessage(flags MojoReadMessageFlags) (MojoResult, []byte, []UntypedHandle) {
- h.core.mu.Lock()
- r, buf, rawHandles := sysImpl.ReadMessage(uint32(h.mojoHandle), uint32(flags))
- h.core.mu.Unlock()
- if r != 0 {
- return MojoResult(r), nil, nil
- }
-
- handles := make([]UntypedHandle, len(rawHandles))
- for i := 0; i < len(handles); i++ {
- handles[i] = h.core.AcquireNativeHandle(MojoHandle(rawHandles[i]))
- }
- return MojoResult(r), buf, handles
-}
-
-func (h *messagePipe) WriteMessage(bytes []byte, handles []UntypedHandle, flags MojoWriteMessageFlags) MojoResult {
-
- var rawHandles []uint32
- if len(handles) != 0 {
- rawHandles = make([]uint32, len(handles))
- for i := 0; i < len(handles); i++ {
- rawHandles[i] = uint32(handles[i].ReleaseNativeHandle())
- }
- }
- h.core.mu.Lock()
- r := sysImpl.WriteMessage(uint32(h.mojoHandle), bytes, rawHandles, uint32(flags))
- h.core.mu.Unlock()
- return MojoResult(r)
-}
« no previous file with comments | « mojo/public/go/system/handle.go ('k') | mojo/public/go/system/mojo_types.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698