Skip to content

Commit

Permalink
[web_benchmarks] Remove WebRenderer enum. (flutter#8103)
Browse files Browse the repository at this point in the history
Removes the `WebRenderer` enum, and its uses in the `CompilationOptions` class.

This is a breaking change because it's removing public API (`CompilationOptions.renderer`, `WebRenderer`), but in *practice* people shouldn't need any changes to their code (since the `CompilationOptions` class is used through named constructors). In any case, labeling as `v4.0.0`.

Related: flutter/flutter#145954
  • Loading branch information
ditman authored Nov 15, 2024
1 parent 7dd395e commit 5bf6ac2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
5 changes: 5 additions & 0 deletions packages/web_benchmarks/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 4.0.0

* **Breaking change:** Removes `CompilationOptions.renderer` and the
`WebRenderer` enum.

## 3.1.1

* Adds `missing_code_block_language_in_doc_comment` lint.
Expand Down
25 changes: 3 additions & 22 deletions packages/web_benchmarks/lib/src/compilation_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,16 @@
/// should be built.
class CompilationOptions {
/// Creates a [CompilationOptions] object that compiles to JavaScript.
const CompilationOptions.js({
this.renderer = WebRenderer.canvaskit,
}) : useWasm = false;
const CompilationOptions.js() : useWasm = false;

/// Creates a [CompilationOptions] object that compiles to WebAssembly.
const CompilationOptions.wasm()
: useWasm = true,
renderer = WebRenderer.skwasm;

/// The renderer to use for the build.
final WebRenderer renderer;
const CompilationOptions.wasm() : useWasm = true;

/// Whether to build the app with dart2wasm.
final bool useWasm;

@override
String toString() {
return '(renderer: ${renderer.name}, compiler: ${useWasm ? 'dart2wasm' : 'dart2js'})';
return '(compiler: ${useWasm ? 'dart2wasm' : 'dart2js'})';
}
}

/// The possible types of web renderers Flutter can build for.
enum WebRenderer {
/// The HTML web renderer.
html,

/// The CanvasKit web renderer.
canvaskit,

/// The SKIA Wasm web renderer.
skwasm,
}
3 changes: 1 addition & 2 deletions packages/web_benchmarks/lib/src/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ class BenchmarkServer {
if (compilationOptions.useWasm) ...<String>[
'--wasm',
'--no-strip-wasm',
] else
'--web-renderer=${compilationOptions.renderer.name}',
],
'--dart-define=FLUTTER_WEB_ENABLE_PROFILING=true',
if (!treeShakeIcons) '--no-tree-shake-icons',
'--profile',
Expand Down
2 changes: 1 addition & 1 deletion packages/web_benchmarks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: web_benchmarks
description: A benchmark harness for performance-testing Flutter apps in Chrome.
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
version: 3.1.1
version: 4.0.0

environment:
sdk: ^3.3.0
Expand Down

0 comments on commit 5bf6ac2

Please sign in to comment.