-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS] Supported rendering platform views without merging the raster thread. #53826
Changes from 1 commit
02556ae
b3f6670
b31aae6
75f931a
4525bd8
6ce3aa0
be03cf8
6770376
912cd40
1f65cc3
53adc81
870b950
f8267bd
80565d5
2b9a825
0a7dc5a
2745e88
6002aa0
e7a832f
f099d74
e2e6a2a
44d5b5b
b53063a
9a84539
65a5210
735ce22
a4f523b
b6c3345
a4b771e
cd8e1de
6603d18
27c0daa
d794211
2f4314b
25a4e06
ea2e66d
d220885
9b534cd
970e13a
63ebe66
ff4802a
e3fc731
c0fab3b
d73671e
7285907
bcd8519
b25a742
5f6a8d4
be7853d
b19b4d8
ab08739
6e6e5a2
355ab30
8cd1c74
30e7b97
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,12 @@ | |
|
|
||
| FLUTTER_ASSERT_ARC | ||
|
|
||
| #ifdef FML_OS_IOS_SIMULATOR | ||
| // Note: this is an arbitrary number that attempts to account for cases | ||
| // where the platform view might be momentarily off the screen. | ||
| static const int kDefaultMergedLeaseDuration = 10; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ask to learn - are we still merging the thread (given this variable name?)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are merging threads on the iOS simulator (technically we only need to when using the software backend but that is a harder condition to test). Once we remove skia and the software backend we can remove this condition.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May I ask what's the difference between the simulator and device that we have to merge the thread on simulator?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its not the simulator, its the software backend. The software backend surfaces cannot be used from multiple threads, which this change requires. |
||
| #endif // FML_OS_IOS_SIMULATOR | ||
|
|
||
| @implementation UIView (FirstResponder) | ||
| - (BOOL)flt_hasFirstResponderInViewHierarchySubtree { | ||
| if (self.isFirstResponder) { | ||
|
|
@@ -339,12 +345,43 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect, | |
|
|
||
| PostPrerollResult FlutterPlatformViewsController::PostPrerollAction( | ||
| const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger) { | ||
| // TODO(jonahwilliams): remove this once Software backend is removed for iOS Sim. | ||
| #ifdef FML_OS_IOS_SIMULATOR | ||
| if (composition_order_.empty()) { | ||
| return PostPrerollResult::kSuccess; | ||
| } | ||
| if (!raster_thread_merger->IsMerged()) { | ||
| // The raster thread merger may be disabled if the rasterizer is being | ||
| // created or teared down. | ||
| // | ||
| // In such cases, the current frame is dropped, and a new frame is attempted | ||
| // with the same layer tree. | ||
| // | ||
| // Eventually, the frame is submitted once this method returns `kSuccess`. | ||
| // At that point, the raster tasks are handled on the platform thread. | ||
| CancelFrame(); | ||
| return PostPrerollResult::kSkipAndRetryFrame; | ||
| } | ||
| // If the post preroll action is successful, we will display platform views in the current frame. | ||
| // In order to sync the rendering of the platform views (quartz) with skia's rendering, | ||
| // We need to begin an explicit CATransaction. This transaction needs to be submitted | ||
| // after the current frame is submitted. | ||
| raster_thread_merger->ExtendLeaseTo(kDefaultMergedLeaseDuration); | ||
| return PostPrerollResult::kSuccess; | ||
| #else | ||
| return PostPrerollResult::kSuccess; | ||
| #endif // FML_OS_IOS_SIMULATOR | ||
| } | ||
|
|
||
| void FlutterPlatformViewsController::EndFrame( | ||
| bool should_resubmit_frame, | ||
| const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger) {} | ||
| const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger) { | ||
| #if FML_OS_IOS_SIMULATOR | ||
| if (should_resubmit_frame) { | ||
| raster_thread_merger->MergeWithLease(kDefaultMergedLeaseDuration); | ||
| } | ||
| #endif // FML_OS_IOS_SIMULATOR | ||
| } | ||
|
|
||
| void FlutterPlatformViewsController::PushFilterToVisitedPlatformViews( | ||
| const std::shared_ptr<const DlImageFilter>& filter, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.