Skip to content

Refactor JSNumber.toDart and Object.toJS #129436

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

Merged
merged 1 commit into from
Jul 12, 2023
Merged

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Jun 23, 2023

JSNumber.toDart will now be two functions: toDartDouble and toDartInt.

There was code that did an Object.toJS. This has been changed to
use Function.toJS as well to make it consistent with the code
in flutter/packages: https://github.com/flutter/packages/blob/0ef393811d0c2653e68ac135733353fcad8fffa9/packages/web_benchmarks/lib/src/recorder.dart#L1223

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], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Jun 23, 2023
@srujzs srujzs requested a review from eyebrowsoffire June 26, 2023 22:12
@srujzs
Copy link
Contributor Author

srujzs commented Jun 26, 2023

@eyebrowsoffire These are the framework changes - PTAL when you get a chance, thanks!

@srujzs srujzs force-pushed the todartchanges branch 2 times, most recently from c6334d5 to 7d4ed54 Compare June 30, 2023 00:31
@srujzs
Copy link
Contributor Author

srujzs commented Jun 30, 2023

@eyebrowsoffire FYI - I changed the Object.toJS call to a Function.toJS call (essentially an allowInterop). I was worried about the performance of doing so in my previous patchset, but it looks like the benchmark code in flutter/packages already does this, and this allows us to avoid some backwards compatibility code to persist in JSBoxedDartObject.toDart. I believe this needs to land first before I try and reland flutter/engine#43286. Thanks!

JSNumber.toDart will now be two functions: toDartDouble and
toDartInt.

There was code that did an Object.toJS. This has been changed to
use Function.toJS as well to make it consistent with the code
in flutter/packages: https://github.com/flutter/packages/blob/0ef393811d0c2653e68ac135733353fcad8fffa9/packages/web_benchmarks/lib/src/recorder.dart#L1223
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!

@goderbauer
Copy link
Member

(Triage): Is this good to be submitted? If so, can you throw on the auto-submit label?

@srujzs
Copy link
Contributor Author

srujzs commented Jul 11, 2023

Kind of. I'm waiting to submit this and flutter/engine#43363 at roughly the same time so that I can land the Dart CL that removes some of these members right after. I want to avoid a situation where these members are used in newer code (thus resulting in another CL) before I get to remove them.

@srujzs srujzs merged commit ab39bff into flutter:master Jul 12, 2023
srujzs added a commit to flutter/engine that referenced this pull request Jul 12, 2023
This reverts commit dce75ab.

This also makes some small changes to make onBenchmark a
JSExportedDartFunction instead of a JSBoxedDartObject. This is for
changes in flutter/flutter#129436 and to account
for the fact that flutter/packages provides an `allowInterop`'d
function. Benchmarks tests pass with this CL.

## 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].
- [ ] All existing and new tests are passing.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 13, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 13, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 13, 2023
flutter/flutter@544d30d...c40173f

2023-07-13 [email protected] Revert "Roll Flutter Engine from 16e2ab7e986c to 1b1ccdd1f527 (13 revisions)" (flutter/flutter#130479)
2023-07-13 [email protected] Roll Flutter Engine from 16e2ab7e986c to 1b1ccdd1f527 (13 revisions) (flutter/flutter#130458)
2023-07-13 [email protected] Exclude `Tooltip`'s overlay child from SelectableRegion (flutter/flutter#130181)
2023-07-12 [email protected] Update `Checkbox` tests for M2/M3 (flutter/flutter#130351)
2023-07-12 [email protected] Refactor JSNumber.toDart and Object.toJS (flutter/flutter#129436)
2023-07-12 [email protected]  Reland [a11y] CupertinoSwitch On/Off labels (flutter/flutter#130173)
2023-07-12 [email protected] Add missing links to examples that aren't linked anywhere (flutter/flutter#130422)
2023-07-12 [email protected] Use platform specific line separator in gen-l10n (flutter/flutter#130090)
2023-07-12 [email protected] Update `Divider`/`VerticalDivider` and theme tests for M2/M3 (flutter/flutter#130415)
2023-07-12 [email protected] Roll Flutter Engine from 5c887028810d to 16e2ab7e986c (2 revisions) (flutter/flutter#130421)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
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 Packages: 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
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 13, 2023
JSNumber.toDart will now be two functions: toDartDouble and toDartInt.

There was code that did an Object.toJS. This has been changed to
use Function.toJS as well to make it consistent with the code
in flutter/packages:
https://github.com/flutter/packages/blob/0ef393811d0c2653e68ac135733353fcad8fffa9/packages/web_benchmarks/lib/src/recorder.dart#L1223

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], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
kjlubick pushed a commit to kjlubick/engine that referenced this pull request Jul 14, 2023
This reverts commit dce75ab.

This also makes some small changes to make onBenchmark a
JSExportedDartFunction instead of a JSBoxedDartObject. This is for
changes in flutter/flutter#129436 and to account
for the fact that flutter/packages provides an `allowInterop`'d
function. Benchmarks tests pass with this CL.

## 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].
- [ ] All existing and new tests are passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: contributor-productivity Team-specific productivity, code health, technical debt. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants