A `CkImage` instance holds a reference to `ImageSource?`. When that `CkImage` gets cloned, the `ImageSource` instance becomes shared between the original `CkImage` and its new clone. Then when one of the `CkImage`s gets disposed of, it closes the shared `ImageSource` leaving other live `CkImage`s holding on to a closed `ImageSource`.
The quick solution to this is to have a ref count on the `ImageSource` to count how many `CkImage`s are referencing it. The `ImageSource` will only be closed if its ref count reaches 0.
Fixes https://github.com/flutter/flutter/issues/160199
Fixes https://github.com/flutter/flutter/issues/158093
The RGB565 format documentation in embedder.h incorrectly stated that the red component uses the least significant bits. Unit tests in embedder/testdefs/embedder_unittests.cc demonstrate this is incorrect, showing:
- Red test (0xF800): Uses bits [15:11]
- Green test (0x07E0): Uses bits [10:5]
- Blue test (0x001F): Uses bits [4:0]
This commit fixes the documentation to correctly reflect the actual bit layout:
- Red uses 5 MSBs [15:11]
- Green uses 6 middle bits [10:5]
- Blue uses 5 LSBs [4:0]
Also fixes the example bit extraction code to use correct masks, matching the test expectations.
Impact: This change helps prevent potential developer confusion about RGB565 bit ordering and ensures the documentation matches the actual implementation as verified by the test suite.
Fixes observed sampling problems on the adreno series where slightly different mediump/lowp behavior, resulting in the downsample shader showing "chunky" rendeering.
RBE is not supported for this build. Starting the RBE proxy adds unnecessary overhead, and the attempt to use RBE will cause the build recipe to request too many parallel jobs in Ninja.
When running `dart format` over these lines the `// ignore` ended up on a line where it wasn't properly ignoring the lint. This adjusts the placement of `// ignore`s so they will continue to ignore the right thing even after the code is auto formatted.
I am hoping that if we do this now the large PR that formats the entire repo will go in smoother without manual intervention.
The old path doesn't exist.
`dart format` stumbles over this non-existent include.
`analysis_options.yaml` files that just imported something non-existent were deleted.
I am surprised that this never caused any other issues. Is this all dead code that isn't actually analyzed?
On the bots there were old and stale `package_config.json` files hanging around that confuse the `dart format` command. This PR adds a step to the `pub_get_offline.py` glcient sync hook to delete all of these files that are not under version control.
We are about to `dart format` all the Dart code in the repo, which line-breaks some of our imports.
This PR updates `sdk_rewriter.dart` to support line-broken imports.
This PR limits the search depth, because we don't want to enable this workaround for AdMob banner, which has a WKWebView in the depth of 7. See the previous PR for more context: https://github.com/flutter/engine/pull/57168
I was able to confirm that this returns YES for the 3P plugin, and NO for AdMob.
*List which issues are fixed by this PR. You must list at least one issue.*
https://github.com/flutter/flutter/issues/158961
*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
This change adds entry-point annotations to methods and classes accessed
by native code during engine tests. Currently, entry point annotations
are not checked by the Dart VM when running in JIT mode, only in AOT
mode. In order to also enforce entry point annotations in JIT mode,
first tests in Flutter must be appropriately annotated to avoid roll
failures.
Related issues:
* https://github.com/flutter/flutter/issues/118608
* https://github.com/dart-lang/sdk/issues/50649
Continuing the migration of engine code to the new geometry classes. Only DlRTree and DlRegion are converted in this pass, plus a small amount of associated code.
A flaw in https://github.com/flutter/engine/pull/57153 - SkRRect would normalize the rect (make it right-side up), a feature that Flutter code takes advantage of. We need to do that manually when we ingest a round rect from Flutter.
The original workaround ([PR](https://github.com/flutter/engine/pull/56804)) works for the official web view plugin, but it doesn't work for a third party plugin `flutter_inappwebview` ([issue](https://github.com/pichillilorenzo/flutter_inappwebview)). Upon discussion with the author of that plugin, it turns out that their platform view is not a WKWebView, but rather a wrapper of WKWebView.
This PR performs a DFS search of the view hierarchy, and enable the workaround as long as there's a WKWebView inside.
TODO: pending sample project:
I am quite positive that it should work, but **I haven't tried it since I don't have a sample project yet**. I have requested a sample project with them so I can verify the solution.
*List which issues are fixed by this PR. You must list at least one issue.*
https://github.com/pichillilorenzo/flutter_inappwebview/issues/2415
*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
We can use a macro to distinguish between all of the blend modes. We don't need to distinguish between porter duff/ advanced /pipeline as the pipeline is already labeled with the shader used.
For all snapshots the additional label on the texture isn't useful since we can just look at the command.
Let's start running the tests under `engine/` using the CanvasKit renderer instead of HTML.
This PR also:
- Moves several tests from `engine/` to `html/` since they were testing html-specific stuff.
- Deletes `test/canvaskit/semantics_test.dart` since it's just an "alias" for `test/engine/semantics/semantics_test.dart`.
Eliminates some cases where `FlutterViewController` was relying on `FlutterEngine` internals:
* `[FlutterEngine shell]`
* `[FlutterEngine platformView]`
* `[FlutterEngine iosPlatformView]`
Instead, `FlutterEngine` now exposes:
* `installFirstFrameCallback:`
* `enableSemantics:withFlags:`
* `notifyViewCreated`
* `notifyViewDestroyed`
* `waitForFirstFrameSync:callback:`
Also fixes a couple cases where we were relying on transitive header includes:
* `FlutterAppController` relied on `FlutterViewController_Internal.h` for `sendDeepLinkToFramework:completionHandler:`
This is a refactoring followup to https://github.com/flutter/engine/pull/57099 that introduces no semantic changes.
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
When `dartfmt` formatted `_empty.dart` it formatted it with a trailing newline, which then makes the license script angry. Rather then treating `_empty.dart` special, this just makes it a regular source file with header and everything.
`GetLastError` returns an unsigned 32 bit integer that was being
implicitly cast to an int for the std::variant<..., int>. This was
causing my build to fail with:
```
../../flutter/shell/platform/windows/platform_handler.cc(178,12): error: no viable conversion from returned value of type 'DWORD' (aka 'unsigned long') to function return type 'std::variant<std::wstring, int>' (aka 'variant<basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t>>, int>')
178 | return ::GetLastError();
| ^~~~~~~~~~~~~~~~
../../../../../../../Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.42.34433/include\variant(923,7): note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'DWORD' (aka 'unsigned long') to 'const variant<basic_string<wchar_t>, int> &' for 1st argument
923 | class variant : private _SMF_control<_Variant_destroy_layer<_Types...>, _Types...> { // discriminated union
| ^~~~~~~
```
Commands:
```
./flutter/tools/gn --runtime-mode release --no-rbe
ninja -C .\out\host_release windows gen_snapshot flutter/build/archives:windows_flutter
```
Explicitly casting `::GetLastError` to an int fixes this issue.
I'm running on Windows 11 (Version 10.0.26100 Build 26100) with VS 2022
Community Edition.
@loic-sharma
Co-authored-by: Eric Seidel <eric@shorebird.dev>
The Web Felt script downloads a Chrome zip archive, extracts it to a temporary directory, and then moves the files to a location expected by the script.
Previously Felt used a temporary directory based on io.Directory.systemTemp. This may not work because the FileSystemEntity.rename operation used to move the files can fail if the system temp directory is located in a different filesystem from the destination directory.
Collection of changes to DlVertices::Builder and the stopwatch visualizer.
At a high level:
* improve performance of the stopwatch visualizer by pre-allocating storage (and sharing it across both visualizers), lookup up font once, and cache the debug frame rate used. Updates to use Dl types instead of SkTypes.
* Change DlVerticesBuilder to allow storing the bounds and use that in the visualizer, since we already know them. Make FML_CHECKS into dchecks, as the dart:ui vertices will already bounds check correctly - so these should only be necessary for debugging engine changes.
Labelling textures shows up in all of our profiles because of the cost to lock the context weak ptr and then call into both the image and image view. remove this if no layers are present that would read the label.