9#include "flutter/fml/trace_event.h"
16 size_t max_frames_in_flight)
17 : frames_in_flight_sema_(
std::make_shared<
fml::Semaphore>(
18 std::
max<
std::size_t>(1u, max_frames_in_flight))),
19 context_(
std::move(context)) {
20 if (!context_ || !context_->IsValid()) {
46 if (render_callback && !render_callback(render_target)) {
50 if (!frames_in_flight_sema_->Wait()) {
54 const auto present_result =
surface->Present();
56 frames_in_flight_sema_->Signal();
58 return present_result;
Renderer(std::shared_ptr< Context > context, size_t max_frames_in_flight=kDefaultMaxFramesInFlight)
bool Render(std::unique_ptr< Surface > surface, const RenderCallback &callback) const
std::shared_ptr< Context > GetContext() const
std::function< bool(RenderTarget &render_target)> RenderCallback
static float max(float r, float g, float b)
#define TRACE_EVENT0(category_group, name)