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

Side by Side Diff: mojo/public/go/bindings/interface.go

Issue 1000213003: go/bindings/cgo: allocate C structs on C side (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/platform/native_cgo/system_cgo.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package bindings 5 package bindings
6 6
7 import ( 7 import (
8 "fmt"
8 "mojo/public/go/system" 9 "mojo/public/go/system"
9 ) 10 )
10 11
11 // MessagePipeHandleOwner owns a message pipe handle, it can only pass it 12 // MessagePipeHandleOwner owns a message pipe handle, it can only pass it
12 // invalidating itself or close it. 13 // invalidating itself or close it.
13 type MessagePipeHandleOwner struct { 14 type MessagePipeHandleOwner struct {
14 handle system.MessagePipeHandle 15 handle system.MessagePipeHandle
15 } 16 }
16 17
17 // PassMessagePipe passes ownership of the underlying message pipe handle to 18 // PassMessagePipe passes ownership of the underlying message pipe handle to
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 MessagePipeHandleOwner 54 MessagePipeHandleOwner
54 } 55 }
55 56
56 // CreateMessagePipeForInterface creates a message pipe with interface request 57 // CreateMessagePipeForInterface creates a message pipe with interface request
57 // on one end and interface pointer on the other end. The interface request 58 // on one end and interface pointer on the other end. The interface request
58 // should be attached to appropriate mojo interface implementation and 59 // should be attached to appropriate mojo interface implementation and
59 // the interface pointer should be attached to mojo interface proxy. 60 // the interface pointer should be attached to mojo interface proxy.
60 func CreateMessagePipeForMojoInterface() (InterfaceRequest, InterfacePointer) { 61 func CreateMessagePipeForMojoInterface() (InterfaceRequest, InterfacePointer) {
61 r, h0, h1 := system.GetCore().CreateMessagePipe(nil) 62 r, h0, h1 := system.GetCore().CreateMessagePipe(nil)
62 if r != system.MOJO_RESULT_OK { 63 if r != system.MOJO_RESULT_OK {
63 » » panic("can't create a message pipe") 64 » » panic(fmt.Sprintf("can't create a message pipe: %v", r))
64 } 65 }
65 return InterfaceRequest{MessagePipeHandleOwner{h0}}, InterfacePointer{Me ssagePipeHandleOwner{h1}} 66 return InterfaceRequest{MessagePipeHandleOwner{h0}}, InterfacePointer{Me ssagePipeHandleOwner{h1}}
66 } 67 }
OLDNEW
« no previous file with comments | « no previous file | mojo/public/platform/native_cgo/system_cgo.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698