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

Use utf8.encode() instead of longer const Utf8Encoder.convert() #43675

Merged
merged 2 commits into from Jul 14, 2023

Conversation

mkustermann
Copy link
Member

The change in [0] has propagated now everywhere, so we can use
utf8.encode() instead of the longer const Utf8Encoder.convert().

Also it cleans up code like

  Uint8List bytes;
  bytes.buffer.asByteData();

as that is not guaranteed to be correct, the correct version would be

  Uint8List bytes;
  bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length);

a shorter hand for that is:

  Uint8List bytes;
  ByteData.sublistView(bytes);

[0] dart-lang/sdk#52801

@github-actions github-actions bot added platform-web Code specifically for the web engine platform-windows platform-fuchsia labels Jul 14, 2023
The change in [0] has propagated now everywhere, so we can use
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.

Also it cleans up code like

```
  Uint8List bytes;
  bytes.buffer.asByteData();
```

as that is not guaranteed to be correct, the correct version would be

```
  Uint8List bytes;
  bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length);
```

a shorter hand for that is:

```
  Uint8List bytes;
  ByteData.sublistView(bytes);
```

[0] dart-lang/sdk#52801
'wheel_y_physical_pixel': wheelYPhysicalPixel,
}))
.buffer
.asByteData();

Choose a reason for hiding this comment

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

Make this final message = ByteData.sublistView(utf8.encode(json.encode({...}))); like the change in parent_view.dart?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, missed that one.

Copy link
Member Author

@mkustermann mkustermann left a comment

Choose a reason for hiding this comment

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

PTAL

'wheel_y_physical_pixel': wheelYPhysicalPixel,
}))
.buffer
.asByteData();
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, missed that one.

@mkustermann mkustermann merged commit 3a1b12a into flutter:main Jul 14, 2023
27 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 14, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jul 14, 2023
…130577)

flutter/engine@427ceaf...3a1b12a

2023-07-14 kustermann@google.com Use utf8.encode() instead of longer const Utf8Encoder.convert() (flutter/engine#43675)

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 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
kjlubick pushed a commit to kjlubick/engine that referenced this pull request Jul 14, 2023
…ter#43675)

The change in [0] has propagated now everywhere, so we can use 
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.

Also it cleans up code like

```
  Uint8List bytes;
  bytes.buffer.asByteData();
```

as that is not guaranteed to be correct, the correct version would be

```
  Uint8List bytes;
  bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length);
```

a shorter hand for that is:

```
  Uint8List bytes;
  ByteData.sublistView(bytes);
```

[0] dart-lang/sdk#52801
harryterkelsen pushed a commit to harryterkelsen/engine that referenced this pull request Jul 20, 2023
…ter#43675)

The change in [0] has propagated now everywhere, so we can use 
`utf8.encode()` instead of the longer `const Utf8Encoder.convert()`.

Also it cleans up code like

```
  Uint8List bytes;
  bytes.buffer.asByteData();
```

as that is not guaranteed to be correct, the correct version would be

```
  Uint8List bytes;
  bytes.buffer.asByteData(bytes.offsetInBytes, bytes.length);
```

a shorter hand for that is:

```
  Uint8List bytes;
  ByteData.sublistView(bytes);
```

[0] dart-lang/sdk#52801
LouiseHsu pushed a commit to LouiseHsu/flutter that referenced this pull request Jul 31, 2023
…lutter#130577)

flutter/engine@427ceaf...3a1b12a

2023-07-14 kustermann@google.com Use utf8.encode() instead of longer const Utf8Encoder.convert() (flutter/engine#43675)

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 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-fuchsia platform-web Code specifically for the web engine platform-windows
Projects
None yet
2 participants