| 164 | } |
| 165 | |
| 166 | void SchedClosure(std::function<void()> closure) { |
| 167 | if (!tracing::EventCollector::IsEnabled()) { |
| 168 | return Env::Default()->SchedClosure(std::move(closure)); |
| 169 | } |
| 170 | uint64 id = tracing::GetUniqueArg(); |
| 171 | tracing::RecordEvent(tracing::EventCategory::kScheduleClosure, id); |
| 172 | |
| 173 | Env::Default()->SchedClosure([id, closure = std::move(closure)]() { |
| 174 | tracing::ScopedRegion region(tracing::EventCategory::kRunClosure, id); |
| 175 | closure(); |
| 176 | }); |
| 177 | } |
| 178 | |
| 179 | void SchedNonBlockingClosureAfter(int64 micros, std::function<void()> closure) { |
| 180 | Env::Default()->SchedClosureAfter(micros, std::move(closure)); |