Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor JSNumber.toDart and Object.toJS #43149

Merged
merged 1 commit into from Jun 26, 2023
Merged

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Jun 23, 2023

JSNumber.toDart will now be two functions: toDartDouble and toDartInt. Note that some code that looks like toDart.toInt() was kept as toDartDouble.toInt() instead of toDartInt, since toDartInt throws if the value is not an integer.

Object.toJS is now Object.toJSBox. An actual box is introduced on all backends now, and is unwrapped in JSBoxedDartObject.toDart. There are many usages of toJSAnyShallow that we should modify, but that's for a later CL.

This is to help land this CL: https://dart-review.googlesource.com/c/sdk/+/309082

https://dart-review.googlesource.com/c/sdk/+/309081 is the CL that added the new methods.

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides].
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the [CLA].
  • All existing and new tests are passing.

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jun 23, 2023
@@ -12,8 +12,7 @@ import 'platform_dispatcher.dart';
import 'safe_browser_api.dart';

@JS('window._flutter_internal_on_benchmark')
external JSAny? get _onBenchmark;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do note that this means there is a proper box in JS now for this code. It doesn't seem like there will be performance implications but I'm not entirely sure. Here is the framework PR that needs to be landed after this one: flutter/flutter#129436. If we're worried about performance, I'm happy to use the helpers like toObjectShallow there, but the framework will need to know whether the platform is Wasm or not to reuse those helpers.

JSNumber.toDart will now be two functions: toDartDouble and
toDartInt. Note that some code that looks like `toDart.toInt()`
was kept as `toDartDouble.toInt()` instead of `toDartInt`, since
`toDartInt` throws if the value is not an integer.

Object.toJS is now Object.toJSBox. An actual box is introduced on
all backends now, and is unwrapped in JSBoxedDartObject.toDart.
There are many usages of toJSAnyShallow that we should modify, but
that's for a later CL.
@srujzs
Copy link
Contributor Author

srujzs commented Jun 26, 2023

@eyebrowsoffire PTAL, thanks!

Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@srujzs srujzs merged commit 715eff2 into flutter:main Jun 26, 2023
27 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 26, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jun 26, 2023
…129593)

flutter/engine@0da06de...715eff2

2023-06-26 58529443+srujzs@users.noreply.github.com Refactor JSNumber.toDart and Object.toJS (flutter/engine#43149)
2023-06-26 jonahwilliams@google.com [Impeller] Treat SubOptimalKHR as rotated. (flutter/engine#43214)
2023-06-26 skia-flutter-autoroll@skia.org Roll ANGLE from f6c7dc891859 to 4a4b13cc6931 (12 revisions) (flutter/engine#43213)
2023-06-26 skia-flutter-autoroll@skia.org Roll Skia from 632fa401098d to 4ae209493390 (3 revisions) (flutter/engine#43212)

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 jsimmons@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
ditman added a commit that referenced this pull request Jun 27, 2023
auto-submit bot pushed a commit that referenced this pull request Jun 27, 2023
Reverts #43149

Reason for reverting: Broke the roll into the framework.
kjlubick pushed a commit to kjlubick/engine that referenced this pull request Jul 14, 2023
JSNumber.toDart will now be two functions: toDartDouble and toDartInt.
Note that some code that looks like `toDart.toInt()` was kept as
`toDartDouble.toInt()` instead of `toDartInt`, since `toDartInt` throws
if the value is not an integer.

Object.toJS is now Object.toJSBox. An actual box is introduced on all
backends now, and is unwrapped in JSBoxedDartObject.toDart. There are
many usages of toJSAnyShallow that we should modify, but that's for a
later CL.

This is to help land this CL:
https://dart-review.googlesource.com/c/sdk/+/309082

https://dart-review.googlesource.com/c/sdk/+/309081 is the CL that added
the new methods.

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide] and the [C++,
Objective-C, Java style guides].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [ ] I added new tests to check the change I am making or feature I am
adding, or Hixie said the PR is test-exempt. See [testing the engine]
for instructions on writing and running engine tests.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [x] I signed the [CLA].
- [x] All existing and new tests are passing.
kjlubick pushed a commit to kjlubick/engine that referenced this pull request Jul 14, 2023
Reverts flutter#43149

Reason for reverting: Broke the roll into the framework.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-web Code specifically for the web engine
Projects
None yet
2 participants