| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 package system | |
| 6 | |
| 7 import ( | |
| 8 "unsafe" | |
| 9 | |
| 10 t "mojo/public/go/system/impl" | |
| 11 ) | |
| 12 | |
| 13 // Core is an interface that defines the set of Mojo system APIs. | |
| 14 type Core interface { | |
| 15 // GetTimeTicksNow returns a monotonically increasing platform | |
| 16 // dependent tick count representing "right now". Resolution | |
| 17 // depends on the system configuration. | |
| 18 GetTimeTicksNow() t.MojoTimeTicks | |
| 19 | |
| 20 // Close closes the given handle. | |
| 21 Close(handle t.MojoHandle) (result t.MojoResult) | |
| 22 | |
| 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 satisfied or until deadline has passed. | |
| 26 // Notes about return values: | |
| 27 // |state| can be nil if the signal array could not be returned. This
can | |
| 28 // happen with errors such as MOJO_RESULT_INVALID_ARGUMENT. | |
| 29 Wait(handle t.MojoHandle, signal t.MojoHandleSignals, deadline t.MojoDea
dline) (result t.MojoResult, state *t.MojoHandleSignalsState) | |
| 30 | |
| 31 // WaitMany behaves as if Wait were called on each handle/signal pair | |
| 32 // simultaneously and completing when the first Wait would complete. | |
| 33 // Notes about return values: | |
| 34 // |index| can be nil if the error returned was not caused by a | |
| 35 // particular handle. For example, the error MOJO_RESULT_DEADLINE_
EXCEEDED | |
| 36 // is not related to a particular handle. | |
| 37 // |state| can be nil if the signal array could not be returned. This
can | |
| 38 // happen with errors such as MOJO_RESULT_INVALID_ARGUMENT. | |
| 39 WaitMany(handles []t.MojoHandle, signals []t.MojoHandleSignals, deadline
t.MojoDeadline) (result t.MojoResult, index *uint32, state []t.MojoHandleSignal
sState) | |
| 40 | |
| 41 // CreateMessagePipe creates a message pipe which is a bidirectional | |
| 42 // communication channel for framed data (i.e., messages). Messages | |
| 43 // can contain plain data and/or Mojo handles. On success, it returns | |
| 44 // handles to the two endpoints of the message pipe. | |
| 45 CreateMessagePipe(opts *t.MessagePipeOptions) (result t.MojoResult, hand
le0 t.MojoHandle, handle1 t.MojoHandle) | |
| 46 | |
| 47 // WriteMessage writes message data and optional attached handles to | |
| 48 // the message pipe endpoint given by handle. On success the attached | |
| 49 // handles will no longer be valid (ie: the receiver will receive | |
| 50 // equivalent but logically different handles). | |
| 51 WriteMessage(handle t.MojoHandle, msg []byte, attached []t.MojoHandle, f
lags t.MojoWriteMessageFlags) (result t.MojoResult) | |
| 52 | |
| 53 // ReadMessage reads a message from the message pipe endpoint given | |
| 54 // by handle with the specified flags. Returns the message data and | |
| 55 // attached handles that were received and the number of bytes and | |
| 56 // attached handles in the "next" message. | |
| 57 ReadMessage(handle t.MojoHandle, flags t.MojoReadMessageFlags) (result t
.MojoResult, msg []byte, attached []t.MojoHandle, numBytes uint32, numHandles ui
nt32) | |
| 58 | |
| 59 // CreateDataPipe creates a data pipe which is a unidirectional | |
| 60 // communication channel for unframed data. On success, returns a | |
| 61 // handle to the producer and consumer of the data pipe. | |
| 62 CreateDataPipe(opts *t.DataPipeOptions) (result t.MojoResult, producer t
.MojoHandle, consumer t.MojoHandle) | |
| 63 | |
| 64 // WriteData writes data to the data pipe producer handle with the | |
| 65 // given flags. On success, returns the number of bytes that were | |
| 66 // actually written. | |
| 67 WriteData(producer t.MojoHandle, data []byte, flags t.MojoWriteDataFlags
) (result t.MojoResult, numBytes uint32) | |
| 68 | |
| 69 // ReadData reads data from the data pipe consumer handle with the | |
| 70 // given flags. On success, returns the data that was read. | |
| 71 ReadData(consumer t.MojoHandle, flags t.MojoReadDataFlags) (result t.Moj
oResult, data []byte) | |
| 72 | |
| 73 // CreateSharedBuffer creates a buffer of size numBytes that can be | |
| 74 // shared between applications. One must call MapBuffer to access | |
| 75 // the buffer. | |
| 76 CreateSharedBuffer(opts *t.SharedBufferOptions, numBytes uint64) (result
t.MojoResult, handle t.MojoHandle) | |
| 77 | |
| 78 // DuplicateBufferHandle duplicates the handle to a buffer. | |
| 79 DuplicateBufferHandle(handle t.MojoHandle, opts *t.DuplicateBufferHandle
Options) (result t.MojoResult, duplicate t.MojoHandle) | |
| 80 | |
| 81 // MapBuffer maps the requested part of the shared buffer given by | |
| 82 // handle into memory with specified flags. On success, it returns | |
| 83 // a pointer to the requested shared buffer. | |
| 84 MapBuffer(handle t.MojoHandle, offset uint64, numBytes uint64, flags t.M
ojoMapBufferFlags) (result t.MojoResult, buffer unsafe.Pointer) | |
| 85 | |
| 86 // UnmapBuffer unmaps a buffer pointer that was returned by MapBuffer. | |
| 87 UnmapBuffer(buffer unsafe.Pointer) (result t.MojoResult) | |
| 88 } | |
| OLD | NEW |