Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Original file line number Diff line number Diff line change
Expand Up @@ -251,22 +251,21 @@
composition_order_ = active_composition_order_;
}

bool FlutterPlatformViewsController::HasPendingViewOperations() {
if (!views_to_dispose_.empty()) {
return true;
}
if (!views_to_recomposite_.empty()) {
return true;
}
return active_composition_order_ != composition_order_;
// TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474
// Make this method check if there are pending view operations instead.
// Also rename it to `HasPendingViewOperations`.
bool FlutterPlatformViewsController::HasPlatformViewThisOrNextFrame() {
return composition_order_.size() > 0 || active_composition_order_.size() > 0;
}

const int FlutterPlatformViewsController::kDefaultMergedLeaseDuration;

PostPrerollResult FlutterPlatformViewsController::PostPrerollAction(
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) {
const bool uiviews_mutated = HasPendingViewOperations();
if (uiviews_mutated) {
// TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474
// Rename `has_platform_view` to `view_mutated` when the above issue is resolved.
const bool has_platform_view = HasPlatformViewThisOrNextFrame();
if (has_platform_view) {
if (raster_thread_merger->IsMerged()) {
raster_thread_merger->ExtendLeaseTo(kDefaultMergedLeaseDuration);
} else {
Expand Down Expand Up @@ -485,7 +484,7 @@
// Any UIKit related code has to run on main thread.
// When on a non-main thread, we only allow the rest of the method to run if there is no
// Pending UIView operations.
FML_DCHECK([[NSThread currentThread] isMainThread] || !HasPendingViewOperations());
FML_DCHECK([[NSThread currentThread] isMainThread] || !HasPlatformViewThisOrNextFrame());

DisposeViews();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,12 @@ class FlutterPlatformViewsController {
// Dispose the views in `views_to_dispose_`.
void DisposeViews();

// This will return true after pre-roll if any of the embedded views
// have mutated for last layer tree.
bool HasPendingViewOperations();
// Returns true if there are embedded views in the scene at current frame
// Or there will be embedded views in the next frame.
// TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474
// Make this method check if there are pending view operations instead.
// Also rename it to `HasPendingViewOperations`.
bool HasPlatformViewThisOrNextFrame();

// Traverse the `mutators_stack` and return the number of clip operations.
int CountClips(const MutatorsStack& mutators_stack);
Expand Down