|
251 | 251 | composition_order_ = active_composition_order_; |
252 | 252 | } |
253 | 253 |
|
254 | | -bool FlutterPlatformViewsController::HasPendingViewOperations() { |
255 | | - if (!views_to_dispose_.empty()) { |
256 | | - return true; |
257 | | - } |
258 | | - if (!views_to_recomposite_.empty()) { |
259 | | - return true; |
260 | | - } |
261 | | - return active_composition_order_ != composition_order_; |
| 254 | +// TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474 |
| 255 | +// Make this method check if there are pending view operations instead. |
| 256 | +// Also rename it to `HasPendingViewOperations`. |
| 257 | +bool FlutterPlatformViewsController::HasPlatformViewThisOrNextFrame() { |
| 258 | + return composition_order_.size() > 0 || active_composition_order_.size() > 0; |
262 | 259 | } |
263 | 260 |
|
264 | 261 | const int FlutterPlatformViewsController::kDefaultMergedLeaseDuration; |
265 | 262 |
|
266 | 263 | PostPrerollResult FlutterPlatformViewsController::PostPrerollAction( |
267 | 264 | fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger) { |
268 | | - const bool uiviews_mutated = HasPendingViewOperations(); |
269 | | - if (uiviews_mutated) { |
| 265 | + // TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474 |
| 266 | + // Rename `has_platform_view` to `view_mutated` when the above issue is resolved. |
| 267 | + const bool has_platform_view = HasPlatformViewThisOrNextFrame(); |
| 268 | + if (has_platform_view) { |
270 | 269 | if (raster_thread_merger->IsMerged()) { |
271 | 270 | raster_thread_merger->ExtendLeaseTo(kDefaultMergedLeaseDuration); |
272 | 271 | } else { |
|
485 | 484 | // Any UIKit related code has to run on main thread. |
486 | 485 | // When on a non-main thread, we only allow the rest of the method to run if there is no |
487 | 486 | // Pending UIView operations. |
488 | | - FML_DCHECK([[NSThread currentThread] isMainThread] || !HasPendingViewOperations()); |
| 487 | + FML_DCHECK([[NSThread currentThread] isMainThread] || !HasPlatformViewThisOrNextFrame()); |
489 | 488 |
|
490 | 489 | DisposeViews(); |
491 | 490 |
|
|
0 commit comments