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

Conversation

@eyebrowsoffire
Copy link
Contributor

@eyebrowsoffire eyebrowsoffire commented Sep 28, 2023

Use the newly exposed functionality in dart:_wasm to fix up two different hacks we have:

  1. When creating an image from an image source, use wasm:import instead of @Native and pass the image source directly as an externref. (Direct wasm binding instead of a JS interop shim, yay).
  2. When binding the surface callback, previously we were wrapping the callback in a JS function, and then using WebAssembly.Function to create a wasm function wrapper around that. Now, we can create a WasmFuncRef that is a direct reference to a dart function and pass that over. Now there are no intermediary JavaScript layers when skwasm calls back to us, and we no longer are dependent on the type reflection flag in Chrome.

This fixes flutter/flutter#134556

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 29, 2023
…o skwasm. (#135723)

Some upcoming engine changes will bind to a function provided by the emscripten JS wrapper around skwasm, rather than just the wasm module itself. This will make sure not to break the benchmarks when those engine changes land. See flutter/engine#46388
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -1,7 +1,8 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New code here (and this file in general) could use some dartdocs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments.

@eyebrowsoffire eyebrowsoffire added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 29, 2023
@auto-submit auto-submit bot merged commit 58fd524 into flutter:main Sep 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 29, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 29, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Sep 29, 2023
flutter/engine@48973d7...d203e34

2023-09-29 [email protected] Multi-view Rasterizer  (flutter/engine#45512)
2023-09-29 [email protected] Roll Dart SDK from 955a3a964621 to 0931bb8a43c8 (1 revision) (flutter/engine#46423)
2023-09-29 [email protected] [Impeller] Redo simplify invert colors. (flutter/engine#46416)
2023-09-29 [email protected] Use `dart:_wasm` constructs to avoid dependence on `WebAssembly.Function` (flutter/engine#46388)
2023-09-29 [email protected] Roll Skia from 2d4045f55fd5 to a063eaeaf1e0 (6 revisions) (flutter/engine#46420)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] 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
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…o skwasm. (flutter#135723)

Some upcoming engine changes will bind to a function provided by the emscripten JS wrapper around skwasm, rather than just the wasm module itself. This will make sure not to break the benchmarks when those engine changes land. See flutter/engine#46388
Mairramer pushed a commit to Mairramer/flutter that referenced this pull request Oct 10, 2023
…5776)

flutter/engine@48973d7...d203e34

2023-09-29 [email protected] Multi-view Rasterizer  (flutter/engine#45512)
2023-09-29 [email protected] Roll Dart SDK from 955a3a964621 to 0931bb8a43c8 (1 revision) (flutter/engine#46423)
2023-09-29 [email protected] [Impeller] Redo simplify invert colors. (flutter/engine#46416)
2023-09-29 [email protected] Use `dart:_wasm` constructs to avoid dependence on `WebAssembly.Function` (flutter/engine#46388)
2023-09-29 [email protected] Roll Skia from 2d4045f55fd5 to a063eaeaf1e0 (6 revisions) (flutter/engine#46420)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] 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
harryterkelsen pushed a commit that referenced this pull request Oct 23, 2023
…ion` (#46388)

Use the newly exposed functionality in `dart:_wasm` to fix up two different hacks we have:
1) When creating an image from an image source, use `wasm:import` instead of `@Native` and pass the image source directly as an externref. (Direct wasm binding instead of a JS interop shim, yay).
2) When binding the surface callback, previously we were wrapping the callback in a JS function, and then using `WebAssembly.Function` to create a wasm function wrapper around that. Now, we can create a `WasmFuncRef` that is a direct reference to a dart function and pass that over. Now there are no intermediary JavaScript layers when skwasm calls back to us, and we no longer are dependent on the type reflection flag in Chrome.

This fixes flutter/flutter#134556
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Skwasm] Remove dependency on WebAssembly.Function

2 participants