1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
10 t
"mojo/public/go/system/impl"
13 // Core is an interface that defines the set of Mojo system APIs.
15 // GetTimeTicksNow returns a monotonically increasing platform
16 // dependent tick count representing "right now". Resolution
17 // depends on the systemconfiguration.
18 GetTimeTicksNow() t
.MojoTimeTicks
20 // Close closes the given handle.
21 Close(handle t
.MojoHandle
) (result t
.MojoResult
)
23 // Wait waits on the given handle until a signal indicated by signals
24 // is satisfied or it becomes known that no signal indicated by
25 // signals will ever be satisified or until deadline has passed.
26 Wait(handle t
.MojoHandle
, signal t
.MojoHandleSignals
, deadline t
.MojoDeadline
) (result t
.MojoResult
)
28 // WaitMany behaves as if Wait were called on each handle/signal pair
29 // simultaneously and completing when the first Wait would complete.
30 WaitMany(handles
[]t
.MojoHandle
, signals
[]t
.MojoHandleSignals
, deadline t
.MojoDeadline
) (result t
.MojoResult
)
32 // CreateMessagePipe creates a message pipe which is a bidirectional
33 // communication channel for framed data (i.e., messages). Messages
34 // can contain plain data and/or Mojo handles. On success, it returns
35 // handles to the two endpoints of the message pipe.
36 CreateMessagePipe(opts
*t
.MessagePipeOptions
) (result t
.MojoResult
, handle0 t
.MojoHandle
, handle1 t
.MojoHandle
)
38 // WriteMessage writes message data and optional attached handles to
39 // the message pipe endpoint given by handle. On success the attached
40 // handles will no longer be valid (ie: the receiver will receive
41 // equivalent but logically different handles).
42 WriteMessage(handle t
.MojoHandle
, msg
[]byte, attached
[]t
.MojoHandle
, flags t
.MojoWriteMessageFlags
) (result t
.MojoResult
)
44 // ReadMessage reads a message from the message pipe endpoint given
45 // by handle with the specified flags. Returns the message data and
46 // attached handles that were received and the number of bytes and
47 // attached handles in the "next" message.
48 ReadMessage(handle t
.MojoHandle
, flags t
.MojoReadMessageFlags
) (result t
.MojoResult
, msg
[]byte, attached
[]t
.MojoHandle
, numBytes
uint32, numHandles
uint32)
50 // CreateDataPipe creates a data pipe which is a unidirectional
51 // communication channel for unframed data. On success, returns a
52 // handle to the producer and consumer of the data pipe.
53 CreateDataPipe(opts
*t
.DataPipeOptions
) (result t
.MojoResult
, producer t
.MojoHandle
, consumer t
.MojoHandle
)
55 // WriteData writes data to the data pipe producer handle with the
56 // given flags. On success, returns the number of bytes that were
58 WriteData(producer t
.MojoHandle
, data
[]byte, flags t
.MojoWriteDataFlags
) (result t
.MojoResult
, numBytes
uint32)
60 // ReadData reads data from the data pipe consumer handle with the
61 // given flags. On success, returns the data that was read.
62 ReadData(consumer t
.MojoHandle
, flags t
.MojoReadDataFlags
) (result t
.MojoResult
, data
[]byte)
64 // CreateSharedBuffer creates a buffer of size numBytes that can be
65 // shared between applications. One must call MapBuffer to access
67 CreateSharedBuffer(opts
*t
.SharedBufferOptions
, numBytes
uint64) (result t
.MojoResult
, handle t
.MojoHandle
)
69 // DuplicateBufferHandle duplicates the handle to a buffer.
70 DuplicateBufferHandle(handle t
.MojoHandle
, opts
*t
.DuplicateBufferHandleOptions
) (result t
.MojoResult
, duplicate t
.MojoHandle
)
72 // MapBuffer maps the requested part of the shared buffer given by
73 // handle into memory with specified flags. On success, it returns
74 // a pointer to the requested shared buffer.
75 MapBuffer(handle t
.MojoHandle
, offset
uint64, numBytes
uint64, flags t
.MojoMapBufferFlags
) (result t
.MojoResult
, buffer unsafe
.Pointer
)
77 // UnmapBuffer unmaps a buffer pointer that was returned by MapBuffer.
78 UnmapBuffer(buffer unsafe
.Pointer
) (result t
.MojoResult
)