@@ -47,8 +47,8 @@ RuntimeController::RuntimeController(
4747
4848std::unique_ptr<RuntimeController> RuntimeController::Spawn (
4949 RuntimeDelegate& p_client,
50- std::string advisory_script_uri,
51- std::string advisory_script_entrypoint,
50+ const std::string& advisory_script_uri,
51+ const std::string& advisory_script_entrypoint,
5252 const std::function<void (int64_t )>& p_idle_notification_callback,
5353 const fml::closure& p_isolate_create_callback,
5454 const fml::closure& p_isolate_shutdown_callback,
@@ -57,13 +57,18 @@ std::unique_ptr<RuntimeController> RuntimeController::Spawn(
5757 fml::WeakPtr<ImageDecoder> image_decoder,
5858 fml::WeakPtr<ImageGeneratorRegistry> image_generator_registry,
5959 fml::TaskRunnerAffineWeakPtr<SnapshotDelegate> snapshot_delegate) const {
60- UIDartState::Context spawned_context{
61- context_.task_runners , std::move (snapshot_delegate),
62- std::move (io_manager), context_.unref_queue ,
63- std::move (image_decoder), std::move (image_generator_registry),
64- std::move (advisory_script_uri), std::move (advisory_script_entrypoint),
65- context_.volatile_path_tracker , context_.concurrent_task_runner ,
66- context_.enable_impeller , context_.runtime_stage_backend };
60+ UIDartState::Context spawned_context{context_.task_runners ,
61+ std::move (snapshot_delegate),
62+ std::move (io_manager),
63+ context_.unref_queue ,
64+ std::move (image_decoder),
65+ std::move (image_generator_registry),
66+ advisory_script_uri,
67+ advisory_script_entrypoint,
68+ context_.volatile_path_tracker ,
69+ context_.concurrent_task_runner ,
70+ context_.enable_impeller ,
71+ context_.runtime_stage_backend };
6772 auto result =
6873 std::make_unique<RuntimeController>(p_client, //
6974 vm_, //
@@ -226,6 +231,7 @@ bool RuntimeController::SetAccessibilityFeatures(int32_t flags) {
226231
227232bool RuntimeController::BeginFrame (fml::TimePoint frame_time,
228233 uint64_t frame_number) {
234+ MarkAsFrameBorder ();
229235 if (auto * platform_configuration = GetPlatformConfigurationIfAvailable ()) {
230236 platform_configuration->BeginFrame (frame_time, frame_number);
231237 return true ;
@@ -340,22 +346,37 @@ void RuntimeController::ScheduleFrame() {
340346 client_.ScheduleFrame ();
341347}
342348
343- // |PlatformConfigurationClient|
344349void RuntimeController::EndWarmUpFrame () {
345- client_.EndWarmUpFrame ();
350+ client_.OnAllViewsRendered ();
346351}
347352
348353// |PlatformConfigurationClient|
349- void RuntimeController::Render (Scene* scene, double width, double height) {
350- // TODO(dkwingsmt): Currently only supports a single window.
351- int64_t view_id = kFlutterImplicitViewId ;
354+ void RuntimeController::Render (int64_t view_id,
355+ Scene* scene,
356+ double width,
357+ double height) {
352358 const ViewportMetrics* view_metrics =
353359 UIDartState::Current ()->platform_configuration ()->GetMetrics (view_id);
354360 if (view_metrics == nullptr ) {
355361 return ;
356362 }
357- client_.Render (scene->takeLayerTree (width, height),
363+ client_.Render (view_id, scene->takeLayerTree (width, height),
358364 view_metrics->device_pixel_ratio );
365+ rendered_views_during_frame_.insert (view_id);
366+ CheckIfAllViewsRendered ();
367+ }
368+
369+ void RuntimeController::MarkAsFrameBorder () {
370+ rendered_views_during_frame_.clear ();
371+ }
372+
373+ void RuntimeController::CheckIfAllViewsRendered () {
374+ if (rendered_views_during_frame_.size () != 0 &&
375+ rendered_views_during_frame_.size () ==
376+ platform_data_.viewport_metrics_for_views .size ()) {
377+ client_.OnAllViewsRendered ();
378+ MarkAsFrameBorder ();
379+ }
359380}
360381
361382// |PlatformConfigurationClient|
0 commit comments