Add CpuArch to the Device class#189207
Conversation
|
Warning Gemini encountered an error creating the review. You can try again by commenting |
| }; | ||
| } | ||
|
|
||
| String get name => switch (this) { |
There was a problem hiding this comment.
Drive by nit: Enums get a name that resolves to the symbol of the enum value, so this is redundant?
There was a problem hiding this comment.
I forgot about that. Removed, thanks!
| x86_64, | ||
| riscv64; | ||
|
|
||
| factory CpuArch.fromName(String name) { |
There was a problem hiding this comment.
Nit: consider making String name -> String? name and mapping null to CpuArch.unknown.
There was a problem hiding this comment.
The only place that needs to handle null cpuArch now is in proxied_device, and that's only for backward compatibility. I've added a comment there explaining this. Keeping this non-null here for now unless there is a strong reason to accept null String.
| }; | ||
| } | ||
|
|
||
| String get name => switch (this) { |
| Future<TargetPlatform> get targetPlatform; | ||
|
|
||
| /// The CPU architecture of the device. | ||
| Future<CpuArch> get cpuArch async => _cpuArchForTargetPlatform(await targetPlatform); |
There was a problem hiding this comment.
I think it might be worth leaving this unimplemented for the abstract Device class so that platform-specific devices have to implement this, especially since iOS / Darwin devices already need to override it to provide a valid result. This will make it easier when we eventually move each platform into their own isolated extension that won't know anything about the other platforms.
| /// The [CpuArch] of the given [hostPlatform]. | ||
| factory CpuArch.fromHostPlatform(HostPlatform hostPlatform) { | ||
| return switch (hostPlatform) { | ||
| HostPlatform.darwin_x64 || HostPlatform.linux_x64 || HostPlatform.windows_x64 => |
There was a problem hiding this comment.
Nit: is it possible to use dot shorthands here? If we can do that for even just the patterns, it would make these lines a lot shorter.
|
autosubmit label was removed for flutter/flutter/189207, because - The status or check suite Linux web_canvaskit_tests_1 has failed. Please fix the issues identified (or deflake) before re-applying this label. |
flutter/flutter@846664b...fc1ad95 2026-07-15 [email protected] [iOS] Migrate FlutterKeyboardInsetManager to Swift (flutter/flutter#189425) 2026-07-15 [email protected] Roll Dart SDK from 05bf153370c4 to 0c408ff6dce9 (4 revisions) (flutter/flutter#189487) 2026-07-15 [email protected] Implement UberSDF lines to replace LineContents-based AA lines (flutter/flutter#188514) 2026-07-15 [email protected] Fix stale eagerWinner reference in GestureArenaManager when rejected before arena close (flutter/flutter#187008) 2026-07-15 [email protected] Disable some Windows tests that are flaking on CI (flutter/flutter#189477) 2026-07-15 dmgr Added unified check-run user manual (flutter/flutter#189453) 2026-07-15 [email protected] Roll Skia from 88954ef8f36d to ab2410bc857c (9 revisions) (flutter/flutter#189474) 2026-07-14 [email protected] [agents] Refactor shepherd-prs skill into a pure Markdown runbook using native gh CLI (flutter/flutter#189095) 2026-07-14 [email protected] Add missing name to mirroring workflow (flutter/flutter#189439) 2026-07-14 [email protected] Add support for WASM deferred loading. (flutter/flutter#189308) 2026-07-14 [email protected] fix `templateDefaultGradleVersion` todo (flutter/flutter#189466) 2026-07-14 [email protected] Roll Fuchsia Linux SDK from oOETA0ISPouDt2xBo... to lLFbh5kFWbUGgC9Ek... (flutter/flutter#189469) 2026-07-14 [email protected] Use ServicesBinding.instance.exitApplication instead of exit(0) in multiple_windows example (flutter/flutter#189364) 2026-07-14 [email protected] Add CpuArch to the Device class (flutter/flutter#189207) 2026-07-14 [email protected] Fix space formatting in cherry-pick label for flutter_cp.dart (flutter/flutter#189463) 2026-07-14 [email protected] Roll pub packages (flutter/flutter#189454) 2026-07-14 [email protected] [flutter_tools] Format plugin example template to match dart format (flutter/flutter#188382) 2026-07-14 [email protected] Move renamed x64->ARM benchmarks out of bringup (flutter/flutter#189400) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Android and iOS devices have AndroidArch and DarwinArch respectively, and the other TargetPlatforms are cpu architecture specific (e.g. linux_arm64).
Adding the CpuArch is an attempt to consolidate the information, and have a targetPlatform-agnostic way to determine the cpu architecture of the device.