5#include "flutter/shell/common/vsync_waiter_fallback.h"
9#include "flutter/fml/logging.h"
10#include "flutter/fml/message_loop.h"
11#include "flutter/fml/trace_event.h"
32 for_testing_(for_testing) {}
37void VsyncWaiterFallback::AwaitVSync() {
40 auto frame_start_time =
42 auto frame_target_time = frame_start_time + kSingleFrameInterval;
45 frame_start_time.ToEpochDelta().ToMicroseconds(),
47 frame_target_time.ToEpochDelta().ToMicroseconds());
49 std::weak_ptr<VsyncWaiterFallback> weak_this =
50 std::static_pointer_cast<VsyncWaiterFallback>(shared_from_this());
53 [frame_start_time, frame_target_time, weak_this]() {
54 if (
auto vsync_waiter = weak_this.lock()) {
55 vsync_waiter->FireCallback(frame_start_time, frame_target_time,
56 !vsync_waiter->for_testing_);
fml::RefPtr< fml::TaskRunner > GetUITaskRunner() const
VsyncWaiterFallback(const TaskRunners &task_runners, bool for_testing=false)
~VsyncWaiterFallback() override
const TaskRunners task_runners_
virtual void PostTaskForTime(const fml::closure &task, fml::TimePoint target_time)
static constexpr TimeDelta FromSecondsF(double seconds)
static constexpr TimeDelta Zero()
std::chrono::time_point< std::chrono::high_resolution_clock > TimePoint
#define TRACE_EVENT2_INT(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)