Flutter Engine
 
Loading...
Searching...
No Matches
task_observers.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_FML_PLATFORM_FUCHSIA_TASK_OBSERVERS_H_
6#define FLUTTER_FML_PLATFORM_FUCHSIA_TASK_OBSERVERS_H_
7
8#include <lib/fit/function.h>
9
11
12namespace fml {
13
14// Executes all closures that were registered via
15// `CurrentMessageLoopAddAfterTaskObserver` on this thread.
16//
17// WARNING(fxbug.dev/77957): These task observers are distinct from the task
18// observers that can be specified via `fml::MessageLoop::AddTaskObserver` and
19// they behave differently!
20//
21// Task observers registered via `fml::MessageLoop::AddTaskObserver` only fire
22// after work that was posted via the `fml::MessageLoop`'s `TaskRunner`
23// completes. Work that is posted directly to the Fuchsia message loop (e.g.
24// using `async::PostTask(async_get_default_dispatcher(), ...)`) is invisible to
25// `fml::MessageLoop`, so the `fml::MessageLoop`'s task observers don't fire.
26//
27// The task observers registered with `CurrentMessageLoopAddAfterTaskObserver`,
28// however, fire after _every_ work item is completed, regardless of whether it
29// was posted to the Fuchsia message loop directly or via `fml::MessageLoop`.
30//
31// These two mechanisms are redundant and confusing, so we should fix it
32// somehow.
34
36 fit::closure observer);
37
39 intptr_t key);
40
41} // namespace fml
42
43#endif // FLUTTER_FML_PLATFORM_FUCHSIA_TASK_OBSERVERS_H_
fml::TaskQueueId CurrentMessageLoopAddAfterTaskObserver(intptr_t key, fit::closure observer)
void CurrentMessageLoopRemoveAfterTaskObserver(fml::TaskQueueId queue_id, intptr_t key)
void ExecuteAfterTaskObservers()