-
Notifications
You must be signed in to change notification settings - Fork 6k
improve surface state assert error messages #16595
Conversation
644d3db
to
ff81113
Compare
/// Verifies that the [surface] is in one of the valid states. | ||
/// | ||
/// This function should be used inside an assertion expression. | ||
bool debugAssertSurfaceState(PersistedSurface surface, PersistedSurfaceState state1, [PersistedSurfaceState state2, PersistedSurfaceState state3]) { |
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.
I'm curious why you chose this signature vs passing an array of states.
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.
Which one is better
This?
assert(debugAssertSurfaceState(oldSurface, PersistedSurfaceState.active, PersistedSurfaceState.pendingUpdate));
Or this?
assert(debugAssertSurfaceState(oldSurface, const <PersistedSurfaceState>[PersistedSurfaceState.active, PersistedSurfaceState.pendingUpdate]))
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.
Ah right. Explicit types :(
bool debugAssertSurfaceState(PersistedSurface surface, PersistedSurfaceState state1, [PersistedSurfaceState state2, PersistedSurfaceState state3]) { | ||
final List<PersistedSurfaceState> validStates = [ state1, state2, state3 ]; | ||
|
||
if (validStates.contains(surface.state)) { |
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.
Is surface.state
nullable? If it's null, it could mistakenly pass this check.
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.
It is not nullable. We have an assert for that.
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.
I can't wait for Null Safety!
Build redness is Fuchsia infra flakiness |
* c0549fb Roll buildroot. (flutter/engine#16613) * 8b0b649 improve surface state assert error messages (flutter/engine#16595) * cd77e78 Fix drawRRect failure when shader is specified (flutter/engine#16601) * fe63094 [web] Handle alignment correctly in Paragraph.getPositionForOffset (flutter/engine#16569) * 65d1126 [web] Fixing launching Safari. This should solve the LUCI issue (flutter/engine#16590) * f88f7df [web] Unskip tests that are already passing in Safari (flutter/engine#16567) * 594f660 [shell tests] Integrate Vulkan with Shell Tests * 400ed7c Revert "[shell tests] Integrate Vulkan with Shell Tests" * 15e7f51 Implement Path extractPath, tangent APIs (flutter/engine#16599) * 4941ff7 Remove usage of Dart_AllocateWithNativeFields from tonic (flutter/engine#16588) * bb01cb7 Roll fuchsia/sdk/core/linux-amd64 from Bmq1m... to J-_s6... (flutter/engine#16592)
This reverts commit 7016506.
No description provided.