1
0
mirror of https://github.com/golang/go synced 2024-11-08 09:46:24 -07:00
go/src/cmd/trace
Richard Musiol e083dc6307 runtime, sycall/js: add support for callbacks from JavaScript
This commit adds support for JavaScript callbacks back into
WebAssembly. This is experimental API, just like the rest of the
syscall/js package. The time package now also uses this mechanism
to properly support timers without resorting to a busy loop.

JavaScript code can call into the same entry point multiple times.
The new RUN register is used to keep track of the program's
run state. Possible values are: starting, running, paused and exited.
If no goroutine is ready any more, the scheduler can put the
program into the "paused" state and the WebAssembly code will
stop running. When a callback occurs, the JavaScript code puts
the callback data into a queue and then calls into WebAssembly
to allow the Go code to continue running.

Updates #18892
Updates #25506

Change-Id: Ib8701cfa0536d10d69bd541c85b0e2a754eb54fb
Reviewed-on: https://go-review.googlesource.com/114197
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-14 21:50:53 +00:00
..
annotations_test.go runtime, sycall/js: add support for callbacks from JavaScript 2018-06-14 21:50:53 +00:00
annotations.go runtime, sycall/js: add support for callbacks from JavaScript 2018-06-14 21:50:53 +00:00
doc.go
goroutines.go
main.go runtime/trace: rename "Span" with "Region" 2018-04-24 16:33:15 +00:00
pprof.go runtime/trace: rename "Span" with "Region" 2018-04-24 16:33:15 +00:00
trace_test.go runtime, sycall/js: add support for callbacks from JavaScript 2018-06-14 21:50:53 +00:00
trace_unix_test.go cmd/trace: skip GoroutineInSyscall in case time order err 2018-04-10 17:09:30 +00:00
trace.go cmd/trace: fix a few bugs found by staticcheck 2018-05-21 16:18:29 +00:00