flutter_flutter/specs/runloop.md
Hixie e499d36a13 Specs: Move the LayoutManager and RenderNode logic from Element to
Node since it is used by text nodes and document nodes as well.
Specs: Make it possible for an element to set what layout manager
class it uses.
Specs: Expose the root layout manager as mutable state.
Specs: Update the runloop to have more detail.
Specs: Add support for transitions, by making the resolver for a value
know when it has been called for the first time, and giving it access
to the previous cached value, and letting it store state on the render
node.
Other sundry changes.

Review URL: https://codereview.chromium.org/835973003
2015-01-05 14:33:42 -08:00

1.4 KiB

Sky's Run Loop

Sky's run loop consists of running the following, at 120Hz (each loop takes 8.333ms):

  1. Send scroll and resize events if necessary, limiting each handler to 1ms, and limiting the total time spent on these handlers to 1ms.

  2. Fire animation frame callbacks for up to 1ms. Each callback can run for up to 1ms. Once 1ms has expired, throw a (catchable) EDeadlineExceeded exception. If it's not caught, drop subsequent callbacks.

  3. Spend up to 1ms to update the render tree, including calling childAdded(), childRemoved(), and getLayoutManager() as needed. Once 1ms has expired, throw a (catchable) EDeadlineExceeded exception, leaving the render tree in whatever state it has reached.

  4. Update as much of layout as possible; after 1ms, throw a (catchable) EDeadlineExceeded exception, leaving the remaining nodes unprepared.

  5. Update as much of paint as possible; after 1ms, throw a (catchable) EDeadlineExceeded exception, leaving any remaining nodes unprepared.

  6. Send frame to GPU.

  7. Run pending tasks until the 8.333ms expires. Each task may only run for at most 1ms, after 1ms they get a (catchable) EDeadlineExceeded exception. While there are no pending tasks, sleep. Tasks are thingsl like:

    • timers
    • updating the DOM in response to parsing
    • input events
    • mojo callbacks

TODO(ianh): Update the timings above to have some relationship to reality.