Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: flutter/engine
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ff04d2fdd12b
Choose a base ref
...
head repository: flutter/engine
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f4dc96aef71b
Choose a head ref
  • 2 commits
  • 15 files changed
  • 2 contributors

Commits on May 25, 2023

  1. Configuration menu
    Copy the full SHA
    f46ea7e View commit details
    Browse the repository at this point in the history
  2. [macOS] Multi-view thread synchronizer (#41915)

    This PR adapts `FlutterThreadSynchronizer` to multi-view.
    
    ### Problem
    The `FlutterThreadSynchronizer` is a macOS engine class to ensure that, if the current window is resized, nothing will not be presented until the layer tree is drawn with the up-to-date size. 
    
    This class is not compatible with multiview. A simple way to realize it is: while the class is owned by `FlutterView`, it blocks the _global_ platform thread and rasterizer thread - there is got to be some problems. Indeed, when I was testing with multiple windows (#40399), the app freezes as soon as I resize a window.
    
    The problem is because Flutter only have one rasterizer thread. When I'm resizing window A, A's synchronizer detects that the size mismatches, so it blocks the rasterizer thread to wait for an updated content with the updated size. However, window B is to be rendered next, and B's size matches and will try to rasterize, and will be blocked due to the blocked rasterizer thread, window A's updated content will never arrive, causing a deadlock.
    
    ### Changes
    This PR removes the single-view assumption of `FlutterThreadSynchronizer` by making it created by `FlutterEngine` and shared by all `FlutterView`s, and that it prevents rasterization for all views if any view has a mismatched size.
    
    The synchronizer is assigned to the view controller in the `attachToEngine:withId` method (now renamed to `setUpWithEngine:viewId:threadSynchronizer:`.
    
    This PR also adds unit tests for `FlutterThreadSynchronizer`, which didn't have any unit tests at all.
    * To achieve this, the `beginResizeForView:` method no longer checks whether  is called on the main thread, but whether it's called on the main queue. These are equivalent for the real main queue, since the documentation promises that the main queue always executes on the main thread. However, this change allows substituting the queue with a custom one for unit tests.
    
    [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
    dkwingsmt authored May 25, 2023
    Configuration menu
    Copy the full SHA
    f4dc96a View commit details
    Browse the repository at this point in the history
Loading