Documentation
¶
Overview ¶
Package loop has the plain-Go parts of the run loop that macOS and iOS share (SPEC §29.3, §30.2): the heap of timers that one CFRunLoopTimer is set to, the merging of the frame requests of a window, the pacer that starts and stops the display link, and the gate that offers one tick of a display link's thread at a time to the loop. Nothing here calls the operating system, so the tests run on every host.
Flutter: no counterpart
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameRequests ¶
type FrameRequests struct {
// contains filtered or unexported fields
}
FrameRequests merges the requests of one window for a frame (SPEC §29.3): any number made while a frame is wanted are one frame, a request made during a frame asks for the next, and the request of a window that cannot draw (minimized, hidden) is kept until it can.
Flutter: shell/platform/darwin/macos/framework/Source/FlutterVSyncWaiter.mm (one request is answered by one tick of the display link)
func (*FrameRequests) Clear ¶
func (f *FrameRequests) Clear()
Clear drops the request: a frame was drawn for another reason (a live resize draws at once).
Flutter: no counterpart
func (*FrameRequests) Request ¶
func (f *FrameRequests) Request()
Request records a request for a frame.
Flutter: no counterpart
func (*FrameRequests) Take ¶
func (f *FrameRequests) Take(canDraw bool) bool
Take says whether the window draws in this tick: a frame is wanted and the window can draw it. The Request is consumed before the frame is drawn, so that a request made during the frame asks for the one after it.
Flutter: no counterpart
func (*FrameRequests) Wanted ¶
func (f *FrameRequests) Wanted() bool
Wanted says whether a frame is wanted now.
Flutter: no counterpart
type LinkPacer ¶
type LinkPacer struct {
// contains filtered or unexported fields
}
LinkPacer decides when the display link runs (SPEC §29.3): it runs only while some window wants a frame and can draw it, so an idle app has no link ticking. It belongs to the UI thread.
Flutter: no counterpart (FlutterDisplayLink is paused by the vsync waiter when nothing waits)
func (*LinkPacer) Running ¶
Running says whether the link is running now: Update last said to start it and has not said to stop it.
Flutter: no counterpart
type TickGate ¶
type TickGate struct {
// contains filtered or unexported fields
}
TickGate lets one tick of a display link thread (CVDisplayLink calls back on a thread of its own) be offered to the loop at a time: a tick that arrives while the previous one is still waiting is dropped, as Flutter's FlutterDisplayLink does, so a slow loop never collects a queue of ticks. It is safe to use from the link's thread and from the UI thread.
Flutter: shell/platform/darwin/macos/framework/Source/FlutterDisplayLink.mm (the tick is dropped while the main thread has not handled the last)
type Timers ¶
type Timers struct {
// contains filtered or unexported fields
}
Timers is the platform's own heap of timers (SPEC §29.3): one CFRunLoopTimer is set to the earliest deadline (SetNextFire) and the heap runs what is due when it fires. It belongs to the UI thread, so it needs no lock.
Flutter: shell/platform/darwin/macos/framework/Source/FlutterRunLoop.swift FlutterRunLoop (its scheduled blocks run in the main run loop)
func (*Timers) Add ¶
Add arms fn to run at the time and returns the id to cancel it with.
Flutter: no counterpart
func (*Timers) Cancel ¶
Cancel disarms a timer and reports whether it was still armed.
Flutter: no counterpart
func (*Timers) Deadline ¶
Deadline is when the earliest timer is due; ok is false when none is armed, which makes the loop wait for ever.
Flutter: no counterpart