Flutter Engine
The Flutter Engine
|
#include <animator.h>
Classes | |
class | Delegate |
Public Member Functions | |
Animator (Delegate &delegate, const TaskRunners &task_runners, std::unique_ptr< VsyncWaiter > waiter) | |
~Animator () | |
void | RequestFrame (bool regenerate_layer_trees=true) |
void | OnAllViewsRendered () |
Tells the Animator that all views that should render for this frame have been rendered. More... | |
void | Render (int64_t view_id, std::unique_ptr< flutter::LayerTree > layer_tree, float device_pixel_ratio) |
Tells the Animator that this frame needs to render another view. More... | |
const std::weak_ptr< VsyncWaiter > | GetVsyncWaiter () const |
void | ScheduleSecondaryVsyncCallback (uintptr_t id, const fml::closure &callback) |
Schedule a secondary callback to be executed right after the main VsyncWaiter::AsyncWaitForVsync callback (which is added by Animator::RequestFrame ). More... | |
void | EnqueueTraceFlowId (uint64_t trace_flow_id) |
Friends | |
class | testing::ShellTest |
Executor of animations.
In conjunction with the |VsyncWaiter| it allows callers (typically Dart code) to schedule work that ends up generating a |LayerTree|.
Definition at line 30 of file animator.h.
flutter::Animator::Animator | ( | Delegate & | delegate, |
const TaskRunners & | task_runners, | ||
std::unique_ptr< VsyncWaiter > | waiter | ||
) |
Definition at line 25 of file animator.cc.
|
default |
void flutter::Animator::EnqueueTraceFlowId | ( | uint64_t | trace_flow_id | ) |
Definition at line 49 of file animator.cc.
const std::weak_ptr< VsyncWaiter > flutter::Animator::GetVsyncWaiter | ( | ) | const |
Definition at line 213 of file animator.cc.
void flutter::Animator::OnAllViewsRendered | ( | ) |
Tells the Animator that all views that should render for this frame have been rendered.
In regular frames, since all Render
calls must take place during a vsync task, the Animator knows that all views have been rendered at the end of the vsync task, therefore calling this method is not needed.
However, the engine might decide to start it a bit earlier, for example, if the engine decides that no more views can be rendered, so that the rasterization can start a bit earlier.
This method is also useful in warm-up frames. In a warm up frame, Animator::Render
is called out of vsync tasks, and Animator requires an explicit end-of-frame call to know when to send the layer trees to the pipeline.
For more about warm up frames, see PlatformDispatcher.scheduleWarmUpFrame
.
Definition at line 291 of file animator.cc.
void flutter::Animator::Render | ( | int64_t | view_id, |
std::unique_ptr< flutter::LayerTree > | layer_tree, | ||
float | device_pixel_ratio | ||
) |
Tells the Animator that this frame needs to render another view.
This method must be called during a vsync callback, or technically, between Animator::BeginFrame and Animator::EndFrame (both private methods). Otherwise, this call will be ignored.
Definition at line 188 of file animator.cc.
void flutter::Animator::RequestFrame | ( | bool | regenerate_layer_trees = true | ) |
Definition at line 239 of file animator.cc.
void flutter::Animator::ScheduleSecondaryVsyncCallback | ( | uintptr_t | id, |
const fml::closure & | callback | ||
) |
Schedule a secondary callback to be executed right after the main VsyncWaiter::AsyncWaitForVsync
callback (which is added by Animator::RequestFrame
).
Like the callback in AsyncWaitForVsync
, this callback is only scheduled to be called once, and it's supposed to be called in the UI thread. If there is no AsyncWaitForVsync callback (Animator::RequestFrame
is not called), this secondary callback will still be executed at vsync.
This callback is used to provide the vsync signal needed by SmoothPointerDataDispatcher
, and for our own flow events.
PointerDataDispatcher::ScheduleSecondaryVsyncCallback
. Definition at line 297 of file animator.cc.
|
friend |
Definition at line 153 of file animator.h.