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: b2d07388ceb6
Choose a base ref
...
head repository: flutter/engine
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 20034a8d62c4
Choose a head ref
  • 7 commits
  • 9 files changed
  • 6 contributors

Commits on Apr 17, 2023

  1. Roll Fuchsia Linux SDK from atix5Ek_OOxH-uoPA... to Cy5LG4U2InaFLkJGz…

    …... (#41275)
    
    If this roll has caused a breakage, revert this CL and stop the roller
    using the controls here:
    https://autoroll.skia.org/r/fuchsia-linux-sdk-flutter-engine
    Please CC jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
    is aware of the problem.
    
    To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose
    
    To report a problem with the AutoRoller itself, please file a bug:
    https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
    skia-flutter-autoroll authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    794cbd5 View commit details
    Browse the repository at this point in the history
  2. Roll Dart SDK from 786a70d8ef6b to a335e6724332 (1 revision) (#41278)

    https://dart.googlesource.com/sdk.git/+log/786a70d8ef6b..a335e6724332
    
    2023-04-17 dart-internal-merge@dart-ci-internal.iam.gserviceaccount.com Version 3.1.0-12.0.dev
    
    If this roll has caused a breakage, revert this CL and stop the roller
    using the controls here:
    https://autoroll.skia.org/r/dart-sdk-flutter-engine
    Please CC aam@google.com,dart-vm-team@google.com,jacksongardner@google.com,rmistry@google.com on the revert to ensure that a human
    is aware of the problem.
    
    To file a bug in Flutter Engine: https://github.com/flutter/flutter/issues/new/choose
    
    To report a problem with the AutoRoller itself, please file a bug:
    https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug
    
    Documentation for the AutoRoller is here:
    https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
    skia-flutter-autoroll authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    a4f1cbd View commit details
    Browse the repository at this point in the history
  3. [Impeller] Remove ContentContextOptions declarations from AnonymousCo…

    …ntents (#41256)
    
    This is just a copy paste error...
    bdero authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    2a2e631 View commit details
    Browse the repository at this point in the history
  4. [Impeller] Make DoMakeRasterSnapshot output timeline event. (#41197)

    In Skia, there is such a timeline event in `SnapshotControllerSkia::DoMakeRasterSnapshot`. Therefore, since Impeller wants to mimic Skia and this event does take a long time sometimes, it seems reasonable to add this.
    
    [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
    fzyzcjy authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    c55cd11 View commit details
    Browse the repository at this point in the history
  5. null check added to avoid NPE while calling FlutterView.detachFromFlu…

    …tterEngine() (#41082)
    
    Issue fixed by this PR: flutter/flutter#110138
    
    This PR fixes an issue which is causing app crash when User tries to navigate to a new instance **FlutterFragment** (whose old instance is already present in the fragment backstack) in an Activity (which was restored to saved state after being killed in background due to memory pressure).
    
    Detailed case to reproduce the crash and identify its' root cause:
    
    Setup: Let's say we've an Activity1 which has a bottom nav bar with 3 tabs. Each of this 3 tabs are **FlutterFragment** i.e. Fragment1, Fragment2 & Fragment3 and all of them are using separate **FlutterEngine** but all of them will be cached. e.g. Multiple instances of **Fragment1** will be going to use same cached **FlutterEngine1**.
    1. When User opens the app, Fragment1 gets added to fragment backstack
    2. Then User navigates to Fragment2 (gets added to backstack as well)
    3. Then User navigates to Fragment3 (gets added to backstack as well)
    4. Then User puts the app in background. Due to memory pressure OS/platform kills the Activity1 and all 3 FlutterFragments while the app is in background.
    5. Then after sometime User tries to bring the app to foreground from the app stack. Since Activity1 was killed by the OS/platform the app process will try to restore the Activity1 in the same state it was before it got killed. This leads to all 3 fragments present in backstack to get instantiated and then the **onAttach()** gets called for all 3, but only Fragment3 gets **onCreateView()** lifecycle event as it was the top most visible Fragment before the FragmentManager saved the state and app went into background. All 3 FlutterFragment goes through following function calls.
    
    FlutterFragment.onAttach() -> FlutterActivityAndFragmentDelegate.onAttach(). There is a one-to-one mapping between **FlutterFragment <-> FlutterActivityAndFragmentDelegate**
    <img width="977" alt="1" src="https://user-images.githubusercontent.com/8373036/231222642-1596c77c-d127-476b-9bce-8ad2e9cd3639.png">
    FlutterActivityAndFragmentDelegate.onAttach() -> FlutterEngineConnectionRegistry.attachToActivity(). There is a one-to-one mapping between **FlutterEngine <-> FlutterEngineConnectionRegistry**. _**NOTE**: THIS IS VERY IMPORTANT POINT TO KEEP IN MIND TO UNDERSTAND THE ROOT CAAUSE OF THIS CRASH._
    <img width="962" alt="2" src="https://user-images.githubusercontent.com/8373036/231222672-016ee708-c310-49c8-8016-070b6057af7b.png">
    Since all the 3 **FlutterFragment** were just instantiated on activity restore **exclusiveActivity** will be null and exclusiveActivity will be assigned the host **FlutterActivityAndFragmentDelegate**.
    <img width="880" alt="3" src="https://user-images.githubusercontent.com/8373036/231241491-c47f5aa6-96e9-4c1f-b92e-7cfed67381e2.png">
    6. Then FlutterFragment.onCreateView() will be called only for Fragment3 and it will be visible without an issue as its' state gets restored properly.
    7. Then if User tries to navigate to Fragment2 via instantiating new instance of it (this means that now there will be two instances of Fragment2 in the backstack), then there will be crash as it'll go through following function calls.
    
    FlutterFragment.onAttach() -> FlutterActivityAndFragmentDelegate.onAttach().
    <img width="977" alt="1" src="https://user-images.githubusercontent.com/8373036/231222642-1596c77c-d127-476b-9bce-8ad2e9cd3639.png">
    FlutterActivityAndFragmentDelegate.onAttach() -> FlutterEngineConnectionRegistry.attachToActivity().
    <img width="962" alt="2" src="https://user-images.githubusercontent.com/8373036/231222672-016ee708-c310-49c8-8016-070b6057af7b.png">
    THIS IS WHERE THE CRASH STARTS. Since this is the second instance of Fragment2 and both instances are going to use the same cached **FlutterEngine** and hence same **FlutterEngineConnectionRegistry**, this time around **exclusiveActivity** will be non-null as it was assigned during step 5. And since exclusiveActivity will be be non null it'll try to detach from the old **ExclusiveAppComponent** via calling **exclusiveActivity.detachFromFlutterEngine()**.
    <img width="878" alt="7" src="https://user-images.githubusercontent.com/8373036/231241550-09908108-1747-4ec3-bc70-145446b86eae.png">
    FlutterActivityAndFragmentDelegate.detachFromFlutterEngine() -> FlutterFragment.detachFromFlutterEngine()
    <img width="905" alt="4" src="https://user-images.githubusercontent.com/8373036/231222702-5ee739f2-fd71-4e20-807d-e3786e6f27fc.png">
    FlutterFragment.detachFromFlutterEngine() -> FlutterActivityAndFragmentDelegate.onDestroyView(). This ideally should not be called if the hosts'  **FlutterFragments.onCreateView()** was not called in the first place. Also since the previous author has added **// Redundant calls are ok.** comment, I'm guessing that this is just a fallback cleanup.
    <img width="902" alt="5" src="https://user-images.githubusercontent.com/8373036/231222719-2ea28157-bd62-45fe-89ef-dd41ee7b3cca.png">
    THIS IS WHERE THE CRASH HAPPENS. FlutterActivityAndFragmentDelegate.onDestroyView() -> FlutterView.detachFromFlutterEngine(). Since the lifecycle of older instance of this FlutterFragment2 was capped at onAttach(), it's **FlutterView** property will be null and calling FlutterView.detachFromFlutterEngine() will throw NPE.
    <img width="902" alt="6" src="https://user-images.githubusercontent.com/8373036/231222735-55b63911-6a2d-4967-8043-298f4d413f2a.png">
    
    [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
    bastionkid authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    2c6a936 View commit details
    Browse the repository at this point in the history
  6. [rotation_distortion] Use "delayed swap" solution to reduce rotation …

    …distortion (#40730)
    
    The "size interpolation" solution didn't go well (more context [here](#40412 (comment))). Then a new solution came to my mind, and I call it **"delayed swap"**:
    
    In the originally behavior, we swap the width/height immediately before the rotation, resulting in roughly ~4x distortion in the beginning. With "delayed swap" solution, we **swap the width/height right in the middle of the rotation** (i.e. delay the swap for half of the transition duration).
    
    This new "delayed swap" solution gives us the same benefit as the "snapshot" solution: 
    - reducing ~4x distortion to ~2x
    - most distorted frames occur in the middle of rotation when it's moving the fastest, making it hard to notice
    
    And it fixes the drawback of "snapshot" solution: 
    - it works well with dynamic content like animation or video
    - it doesn't have a ~0.5 second penalty when taking the snapshot
    
    Looks pretty good on flutter gallery: 
    
    https://user-images.githubusercontent.com/41930132/228383137-7cd09982-89a9-4c83-bf55-9431de708278.mp4
    
    *List which issues are fixed by this PR. You must list at least one issue.*
    
    Fixes flutter/flutter#16322
    
    *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
    
    [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
    hellohuanlin authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    1c1dfda View commit details
    Browse the repository at this point in the history
  7. Reland "Migrate mac_host_engine to engine v2 builds." (#41279)

    Reverts #41233
    
    The issue this PR was reverted was not replicable. On top of that we added extra precautions to ensure global generators are using left over binaries from out folder. https://flutter-review.googlesource.com/c/recipes/+/41960
    godofredoc authored Apr 17, 2023
    Configuration menu
    Copy the full SHA
    20034a8 View commit details
    Browse the repository at this point in the history
Loading