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
Conversation
@@ -12,8 +12,7 @@ import 'platform_dispatcher.dart'; | |||
import 'safe_browser_api.dart'; | |||
|
|||
@JS('window._flutter_internal_on_benchmark') | |||
external JSAny? get _onBenchmark; |
There was a problem hiding this comment.
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.
@eyebrowsoffire PTAL, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
…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
Reverts #43149 Reason for reverting: Broke the roll into the framework.
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.
Reverts flutter#43149 Reason for reverting: Broke the roll into the framework.
JSNumber.toDart will now be two functions: toDartDouble and toDartInt. Note that some code that looks like
toDart.toInt()
was kept astoDartDouble.toInt()
instead oftoDartInt
, sincetoDartInt
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
///
).