Index: third_party/mojo/src/mojo/public/go/bindings/interface.go |
diff --git a/third_party/mojo/src/mojo/public/go/bindings/interface.go b/third_party/mojo/src/mojo/public/go/bindings/interface.go |
index 03ab791d844989eb8adbac0844f8d19f9397297f..9e449ad3f82f2a5034738d0074b2c6b986025e7b 100644 |
--- a/third_party/mojo/src/mojo/public/go/bindings/interface.go |
+++ b/third_party/mojo/src/mojo/public/go/bindings/interface.go |
@@ -8,16 +8,16 @@ import ( |
"mojo/public/go/system" |
) |
-// messagePipeHandleOwner owns a message pipe handle, it can only pass it |
+// MessagePipeHandleOwner owns a message pipe handle, it can only pass it |
// invalidating itself or close it. |
-type messagePipeHandleOwner struct { |
+type MessagePipeHandleOwner struct { |
handle system.MessagePipeHandle |
} |
// PassMessagePipe passes ownership of the underlying message pipe handle to |
// the newly created handle object, invalidating the underlying handle object |
// in the process. |
-func (o *messagePipeHandleOwner) PassMessagePipe() system.MessagePipeHandle { |
+func (o *MessagePipeHandleOwner) PassMessagePipe() system.MessagePipeHandle { |
if o.handle == nil { |
return &InvalidHandle{} |
} |
@@ -25,18 +25,24 @@ func (o *messagePipeHandleOwner) PassMessagePipe() system.MessagePipeHandle { |
} |
// Close closes the underlying handle. |
-func (o *messagePipeHandleOwner) Close() { |
+func (o *MessagePipeHandleOwner) Close() { |
if o.handle != nil { |
o.handle.Close() |
} |
} |
+// NewMessagePipeHandleOwner creates |MessagePipeHandleOwner| that owns the |
+// provided message pipe handle. |
+func NewMessagePipeHandleOwner(handle system.MessagePipeHandle) MessagePipeHandleOwner { |
+ return MessagePipeHandleOwner{handle} |
+} |
+ |
// InterfaceRequest represents a request from a remote client for an |
// implementation of mojo interface over a specified message pipe. The |
// implementor of the interface should remove the message pipe by calling |
// PassMessagePipe() and attach it to the implementation. |
type InterfaceRequest struct { |
- messagePipeHandleOwner |
+ MessagePipeHandleOwner |
} |
// InterfacePointer owns a message pipe handle with an implementation of mojo |
@@ -44,7 +50,7 @@ type InterfaceRequest struct { |
// interface should remove the message pipe by calling PassMessagePipe() and |
// attach it to the proxy. |
type InterfacePointer struct { |
- messagePipeHandleOwner |
+ MessagePipeHandleOwner |
} |
// CreateMessagePipeForInterface creates a message pipe with interface request |
@@ -56,5 +62,5 @@ func CreateMessagePipeForMojoInterface() (InterfaceRequest, InterfacePointer) { |
if r != system.MOJO_RESULT_OK { |
panic("can't create a message pipe") |
} |
- return InterfaceRequest{messagePipeHandleOwner{h0}}, InterfacePointer{messagePipeHandleOwner{h1}} |
+ return InterfaceRequest{MessagePipeHandleOwner{h0}}, InterfacePointer{MessagePipeHandleOwner{h1}} |
} |