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

Conversation

@dnfield
Copy link
Contributor

@dnfield dnfield commented Jul 15, 2022

This reverts commit 6f19a3e.

Attempts to resolve merge conflicts and update modified/newly added
methods, and fixes the incorrect argument counts
on some of the Path methods.

This reverts commit 6f19a3e.

Attempts to resolve merge conflicts and update modified/newly added
methods, and fixes the incorrect argument counts
on some of the Path methods.
@flutter-dashboard
Copy link

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 (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

@zanderso
Copy link
Member

Looks like there's a segfault in a Picture.toImageSync unit test.

@dnfield
Copy link
Contributor Author

dnfield commented Jul 18, 2022

I had an incorrect FfiNative annotation on the toImage sync and hadn't bothered running all the tests after getting stuff to compile on Friday afternoon. Canvas tests are passing now (I also was missing entries for a couple new methods on there for getting the transform and clip bounds). Let's see what CI thinks this time...

@dnfield
Copy link
Contributor Author

dnfield commented Jul 18, 2022

Filed dart-lang/sdk#49471

@dnfield
Copy link
Contributor Author

dnfield commented Jul 18, 2022

CI is passing - this is ready for review.

@Hixie
Copy link
Contributor

Hixie commented Jul 18, 2022

test-exempt: the existing tests should in theory cover this.

Comment on lines +237 to +238
V(Path, relativeArcToPoint, 8) \
V(Path, relativeConicTo, 6) \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've fixed these compared to last time.

&CLASS::METHOD>::Call); \
}

void* ResolveFfiNativeFunction(const char* name, uintptr_t args) {
Copy link
Member

Choose a reason for hiding this comment

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

Can this be a hash table lookup instead?

Copy link
Member

Choose a reason for hiding this comment

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

Also, does this get cached by the Dart VM, or do we pay this lookup cost on every call?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had raised this and Jason ended up saying: #29607 (comment)

I think we should still do this, but I'm slightly inclined to do it in a separate PR. That said we could do it here.

Copy link
Member

Choose a reason for hiding this comment

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

I did a test implementation of map-based lookup a while ago while reviewing the original version of this PR. I plan to revive it after this PR lands.

The lookup is cached by Dart and is only done once for each native function.

V(SceneBuilder, setCheckerboardRasterCacheImages) \
V(SceneBuilder, build)

FOR_EACH_BINDING(DART_NATIVE_CALLBACK)
Copy link
Member

Choose a reason for hiding this comment

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

Does the DART_NATIVE_CALLBACK macro (and possibly other macros) become dead with this change? Can they be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're still used in the Fuchsia embedding apparently.

// trying to resolve, an exception will be thrown.
#define FFI_FUNCTION_LIST(V) \
/* Constructors */ \
V(Canvas::Create, 6) \
Copy link
Member

Choose a reason for hiding this comment

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

This list should be alphabetized. But is there any way that these lists could go back into the separate files? That seemed easier to manage than this giant list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are alphabetized within their subsections (e.g. all constructors, all "other").

I don't have a strong preference either way here. This was part of Clement's original refactor.

// If there is a mismatch between names or parameter count an @FfiNative is
// trying to resolve, an exception will be thrown.
#define FFI_METHOD_LIST(V) \
V(Image, dispose, 1) \
Copy link
Member

Choose a reason for hiding this comment

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

Same comment about at least alphabetizing, and considering splitting back into separate files if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved Image to the right section, everything else looked alphabetized.

I don't have a strong preference either way for whether we move these to separate files, but I'm somewhat inclined to get this landed first before it ends up with merge conflicts.

@dnfield
Copy link
Contributor Author

dnfield commented Jul 18, 2022

Talked to Zach offline, going to try to land this and follow up on the nits.

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 18, 2022
@dnfield dnfield merged commit 953d0d1 into flutter:main Jul 18, 2022
@dnfield dnfield deleted the reland branch July 18, 2022 22:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jul 19, 2022
@dnfield
Copy link
Contributor Author

dnfield commented Jul 19, 2022

Golem said this negatively impacted code size.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App needs tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants