| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 system | 5 package system |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "unsafe" | 8 "unsafe" |
| 9 | 9 |
| 10 t "mojo/public/go/system/impl" | 10 t "mojo/public/go/system/impl" |
| 11 ) | 11 ) |
| 12 | 12 |
| 13 // Core is an interface that defines the set of Mojo system APIs. | 13 // Core is an interface that defines the set of Mojo system APIs. |
| 14 type Core interface { | 14 type Core interface { |
| 15 // GetTimeTicksNow returns a monotonically increasing platform | 15 // GetTimeTicksNow returns a monotonically increasing platform |
| 16 // dependent tick count representing "right now". Resolution | 16 // dependent tick count representing "right now". Resolution |
| 17 » // depends on the systemconfiguration. | 17 » // depends on the system configuration. |
| 18 GetTimeTicksNow() t.MojoTimeTicks | 18 GetTimeTicksNow() t.MojoTimeTicks |
| 19 | 19 |
| 20 // Close closes the given handle. | 20 // Close closes the given handle. |
| 21 Close(handle t.MojoHandle) (result t.MojoResult) | 21 Close(handle t.MojoHandle) (result t.MojoResult) |
| 22 | 22 |
| 23 // Wait waits on the given handle until a signal indicated by signals | 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 | 24 // is satisfied or it becomes known that no signal indicated by |
| 25 » // signals will ever be satisified or until deadline has passed. | 25 » // signals will ever be satisfied or until deadline has passed. |
| 26 » Wait(handle t.MojoHandle, signal t.MojoHandleSignals, deadline t.MojoDea
dline) (result t.MojoResult) | 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) |
| 27 | 30 |
| 28 // WaitMany behaves as if Wait were called on each handle/signal pair | 31 // WaitMany behaves as if Wait were called on each handle/signal pair |
| 29 // simultaneously and completing when the first Wait would complete. | 32 // simultaneously and completing when the first Wait would complete. |
| 30 » WaitMany(handles []t.MojoHandle, signals []t.MojoHandleSignals, deadline
t.MojoDeadline) (result t.MojoResult) | 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) |
| 31 | 40 |
| 32 // CreateMessagePipe creates a message pipe which is a bidirectional | 41 // CreateMessagePipe creates a message pipe which is a bidirectional |
| 33 // communication channel for framed data (i.e., messages). Messages | 42 // communication channel for framed data (i.e., messages). Messages |
| 34 // can contain plain data and/or Mojo handles. On success, it returns | 43 // can contain plain data and/or Mojo handles. On success, it returns |
| 35 // handles to the two endpoints of the message pipe. | 44 // handles to the two endpoints of the message pipe. |
| 36 CreateMessagePipe(opts *t.MessagePipeOptions) (result t.MojoResult, hand
le0 t.MojoHandle, handle1 t.MojoHandle) | 45 CreateMessagePipe(opts *t.MessagePipeOptions) (result t.MojoResult, hand
le0 t.MojoHandle, handle1 t.MojoHandle) |
| 37 | 46 |
| 38 // WriteMessage writes message data and optional attached handles to | 47 // WriteMessage writes message data and optional attached handles to |
| 39 // the message pipe endpoint given by handle. On success the attached | 48 // the message pipe endpoint given by handle. On success the attached |
| 40 // handles will no longer be valid (ie: the receiver will receive | 49 // handles will no longer be valid (ie: the receiver will receive |
| (...skipping 29 matching lines...) Expand all Loading... |
| 70 DuplicateBufferHandle(handle t.MojoHandle, opts *t.DuplicateBufferHandle
Options) (result t.MojoResult, duplicate t.MojoHandle) | 79 DuplicateBufferHandle(handle t.MojoHandle, opts *t.DuplicateBufferHandle
Options) (result t.MojoResult, duplicate t.MojoHandle) |
| 71 | 80 |
| 72 // MapBuffer maps the requested part of the shared buffer given by | 81 // MapBuffer maps the requested part of the shared buffer given by |
| 73 // handle into memory with specified flags. On success, it returns | 82 // handle into memory with specified flags. On success, it returns |
| 74 // a pointer to the requested shared buffer. | 83 // a pointer to the requested shared buffer. |
| 75 MapBuffer(handle t.MojoHandle, offset uint64, numBytes uint64, flags t.M
ojoMapBufferFlags) (result t.MojoResult, buffer unsafe.Pointer) | 84 MapBuffer(handle t.MojoHandle, offset uint64, numBytes uint64, flags t.M
ojoMapBufferFlags) (result t.MojoResult, buffer unsafe.Pointer) |
| 76 | 85 |
| 77 // UnmapBuffer unmaps a buffer pointer that was returned by MapBuffer. | 86 // UnmapBuffer unmaps a buffer pointer that was returned by MapBuffer. |
| 78 UnmapBuffer(buffer unsafe.Pointer) (result t.MojoResult) | 87 UnmapBuffer(buffer unsafe.Pointer) (result t.MojoResult) |
| 79 } | 88 } |
| OLD | NEW |