8#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FLATLAND_CONNECTION_H_
9#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_FLATLAND_CONNECTION_H_
11#include <fuchsia/ui/composition/cpp/fidl.h>
12#include <lib/async/default.h>
14#include "flutter/fml/closure.h"
15#include "flutter/fml/macros.h"
16#include "flutter/fml/time/time_delta.h"
17#include "flutter/fml/time/time_point.h"
30 fuchsia::ui::composition::MAX_ACQUIRE_RELEASE_FENCE_COUNT;
42 std::function<void(fuchsia::scenic::scheduling::FramePresentedInfo)>;
54 const std::string& debug_label,
55 fuchsia::ui::composition::FlatlandHandle
flatland,
58 async_dispatcher_t* dispatcher = async_get_default_dispatcher());
70 fuchsia::ui::composition::Flatland*
flatland() {
return flatland_.get(); }
73 return {++next_transform_id_};
77 return {++next_content_id_};
101 void OnError(fuchsia::ui::composition::FlatlandError
error);
103 void OnNextFrameBegin(
104 fuchsia::ui::composition::OnNextFrameBeginValues
values);
105 void OnFramePresented(fuchsia::scenic::scheduling::FramePresentedInfo
info);
114 async_dispatcher_t* dispatcher_;
116 fuchsia::ui::composition::FlatlandPtr flatland_;
120 uint64_t next_transform_id_ = 0;
121 uint64_t next_content_id_ = 0;
124 bool present_waiting_for_credit_ =
false;
127 uint64_t next_present_trace_id_ = 0;
144 std::vector<zx::event> acquire_fences_;
147 std::shared_ptr<Overflow> acquire_overflow_;
150 std::vector<zx::event> current_present_release_fences_;
151 std::shared_ptr<Overflow> current_release_overflow_;
155 std::vector<zx::event> previous_present_release_fences_;
156 std::shared_ptr<Overflow> previous_release_overflow_;
158 std::string debug_label_;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
fuchsia::ui::composition::ContentId NextContentId()
fuchsia::ui::composition::Flatland * flatland()
FireCallbackCallback pending_fire_callback_
fml::TimePoint last_presentation_time_
bool first_feedback_received_
void EnqueueReleaseFence(zx::event fence)
uint32_t present_credits_
std::queue< fml::TimePoint > next_presentation_times_
void AwaitVsyncForSecondaryCallback(FireCallbackCallback callback)
fml::TimeDelta vsync_offset_
FlatlandConnection(const std::string &debug_label, fuchsia::ui::composition::FlatlandHandle flatland, fml::closure error_callback, on_frame_presented_event on_frame_presented_callback, async_dispatcher_t *dispatcher=async_get_default_dispatcher())
void EnqueueAcquireFence(zx::event fence)
fml::TimeDelta vsync_interval_
void AwaitVsync(FireCallbackCallback callback)
fuchsia::ui::composition::TransformId NextTransformId()
std::vector< zx::event > fences_
static constexpr TimeDelta FromMilliseconds(int64_t millis)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
static constexpr size_t kMaxFences
std::function< void(fuchsia::scenic::scheduling::FramePresentedInfo)> on_frame_presented_event
std::function< void(fml::TimePoint, fml::TimePoint)> FireCallbackCallback
static constexpr fml::TimeDelta kInitialFlatlandVsyncOffset
std::function< void()> closure