-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[macOS] Change view ID to signed #39958
Conversation
@@ -644,7 +644,7 @@ - (nonnull NSView*)createWithViewIdentifier:(int64_t)viewId arguments:(nullable | |||
@autoreleasepool { | |||
// Create FVC1. | |||
viewController1 = [[FlutterViewController alloc] initWithProject:project]; | |||
EXPECT_EQ(viewController1.id, 0ull); | |||
EXPECT_EQ(viewController1.id, 0ll); |
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.
Should this be just 11
? Same comment for other occurrences in this file
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.
First, if this should be 1l
, then the tests wouldn't pass. :)
Second, all tests here are for the current single-view uses, which only uses the default view. IDs starting from 1 are only for multiviews.
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.
Oh I'm sorry, those are L
s not 1
s. Please ignore this comment, I should check my eye prescription.
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.
LGTM
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.
Sometimes you want negative values to represent special values.
Can you give an example of such a case? Should we be using a different type to represent view IDs if so?
Unsigned integers are dangerous (if compared with signed ones by mistake.)
One could say the same for signed integers, if compared with unsigned ones by mistake ;-)
All that said, an argument that I really do like in favour of signed integers is that that's what we use for the following other identifiers:
- external texture
- platform view
- semantics node
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.
Please define something like typedef int64_t FlutterViewIdentifier
or similar rather than using int64_t
in the public API.
@cbracken That's a good idea, but I find it hard to find a place to put it. This type (as well as |
Are we making progress on this? |
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.
Reverts #39958 Failing the roll to the framework starting with flutter/flutter#123893 One example: https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20dart_plugin_registry_test/21819/overview
This is a reland of #39958, but only contains the minimal changes that removes all references to viewId from public interfaces, reverting these changes from #39576. Flutter doesn't really support multi-view anyway. These methods currently only works for view 0. We better remove them until we mark multi-view stable. It was a mistake that I decided to add them to public interfaces. For the reason why #39958 failed, I'm pretty sure it's the change to [platform_dispatcher.dart](https://github.com/flutter/engine/pull/39958/files#diff-57d6953e215d0e5dd7260ee60b665c812aa730566ef0b30f7ff1e3d661143585) that mysteriously and unintentionally appeared in the change list. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See [testing the engine] for instructions on writing and running engine tests. - [ ] I updated/added relevant documentation (doc comments with `///`). - [ ] I signed the [CLA]. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
This PR makes view ID signed from unsigned int64.
Initially, I made view IDs unsigned because they were opaque anyway. As I'm working deeper into multiview, I found some issues that made me think signed is better:
Therefore I think it's better to change them to signed int64, especially before these APIs are widely used by developers.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.