wrap static method

void wrap(
  1. HttpResponse res,
  2. void handle()
)

Internal: the request handler calls it when it is on. Runs handle in a zone of its own, then the work after res is sent. The work list and the wait for res are made on the first run, so a request that adds no work pays only for the zone.

Implementation

static void wrap(HttpResponse res, void Function() handle) {
  runZoned(handle, zoneValues: <Object, Object>{_key: _Pending(res)});
}