Skip to content

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented May 5, 2021

Part of a quest to make layer usage more sensible, to resolve #81514

Without this change, we unnecessarily replace/recreate the root layer every time we get an update about view configuration, even if the configuration has not actually changed.

I promise I read and fulfilled all the boxes, I'm just lazy about adding x's all over

@dnfield dnfield requested review from goderbauer and yjbanov May 5, 2021 20:18
@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label May 5, 2021
@google-cla google-cla bot added the cla: yes label May 5, 2021
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

}

@override
bool operator==(Object other) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: space between operator and ==?

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

import 'rendering_tester.dart';

void main() {
// Create non-const instances, otherwise tests pass even if the
Copy link
Member

Choose a reason for hiding this comment

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

add a test case for this to encode that two ViewConfiguration returned by this are not identical? (could be part of the ViewConfiguration == and hashCode test)

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 also indirectly covered in the replace root layer test, but added a more explicit one to the == and hashcode test.

final ViewConfiguration viewConfigurationA = createViewConfiguration();
final ViewConfiguration viewConfigurationB = createViewConfiguration();

expect(viewConfigurationA == viewConfigurationB, true);
Copy link
Member

Choose a reason for hiding this comment

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

test != cases ?

Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

LGTM if LGT @goderbauer

lgtm

}

@override
int get hashCode => hashValues(size.hashCode, devicePixelRatio);
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC hashValues already calls .hashCode on its arguments, so passing size.hashCode becomes size.hashCode.hashCode, which, while not wrong, is unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

  • The status or check suite Windows build_tests_2_3 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@fluttergithubbot fluttergithubbot merged commit c84528d into flutter:master May 7, 2021
@dnfield dnfield deleted the view_config branch May 7, 2021 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Establish a lifecycle for Picture objects.

4 participants