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

Conversation

yjbanov
Copy link
Contributor

@yjbanov yjbanov commented Jun 5, 2020

Null-annotate/revise remaining engine code.

Related Issues

flutter/flutter#53661

@yjbanov yjbanov requested a review from zanderso June 5, 2020 19:39
@fluttergithubbot
Copy link
Contributor

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 on the #hackers channel in Chat.

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

@auto-assign auto-assign bot requested a review from iskakaushik June 5, 2020 19:40
return clampedX * clampedX + clampedY * clampedY;
}

class RawRecordingCanvas extends BitmapCanvas
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not a new class. I just moved it from dart:ui to dart:_engine. It should have never been in dart:ui.


/// Returns true on overflow.
bool push(String/*!*/ channel, ByteData/*!*/ data, PlatformMessageResponseCallback/*!*/ callback) {
bool push(String/*!*/ channel, ByteData/*?*/ data, PlatformMessageResponseCallback/*!*/ callback) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing this because looking at the code, the data simply flows through _StoredMessage, and it's up to the framework to interpret the data. Given that most other platform message API allow ByteData to be null, I'm making it nullable as well. However, handleMessage below is different. data cannot be null there because it's used by control channel only, which seems to have a more specific schema. In particular, it never passes null.

/// recorded thus far. After calling this function, both the picture recorder
/// and the canvas objects are invalid and cannot be used further.
///
/// Returns null if the PictureRecorder is not associated with a canvas.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Backpedaled on this change. Updating the dartdoc instead.

/// This is equivalent to [pushTransform] with a matrix with only translation.
///
/// See [pop] for details about the operation stack.
OffsetEngineLayer pushOffset(
Copy link
Member

Choose a reason for hiding this comment

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

Here and below, do these return types need annotations? Or do only the non-abstract subclasses need the annotations?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These should be annotated. Abstract methods don't provide any signal to the tool to decide whether return type can or cannot be null. Done.


/// Initializes domRenderer with specific devicePixelRatio and physicalSize.
Future<void> webOnlyInitializeTestDomRenderer({double devicePixelRatio = 3.0}) {
Future<void> webOnlyInitializeTestDomRenderer({double/*!*/ devicePixelRatio = 3.0}) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Future<void> webOnlyInitializeTestDomRenderer({double/*!*/ devicePixelRatio = 3.0}) {
Future<void>/*!*/ webOnlyInitializeTestDomRenderer({double/*!*/ devicePixelRatio = 3.0}) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@yjbanov
Copy link
Contributor Author

yjbanov commented Jun 6, 2020

LUCI failures say "Infra failure", so will merge, but OK with reverting if this causes problems.

@yjbanov yjbanov merged commit ff6462e into flutter:master Jun 6, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 6, 2020
cg021 pushed a commit to cg021/engine that referenced this pull request Jun 9, 2020
* null-annotate remaining engine code
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants