Make shader warm-up async so it can handle image (#28687)

## Description

This moves another 15-20ms from the animation jank of one of our important client to the startup latency. Unfortunately, this is probably not captured in our current benchmarks (presumably some other bottlenecks overshadow this shader compilation in the worst_frame benchmark). Considering that drawing images is such a common operation, maybe we should add one in the future to benchmark this.

We need this PR to land soon for our client because this changes the API to return Future.

## Related Issues

https://github.com/flutter/flutter/issues/813
This commit is contained in:
liyuqian
2019-02-28 20:07:55 -08:00
committed by GitHub
parent 98739667ae
commit c63dcf3bcd
3 changed files with 40 additions and 10 deletions

View File

@@ -10,8 +10,8 @@ import 'package:macrobenchmarks/main.dart' as app;
class CubicBezierShaderWarmUp extends DefaultShaderWarmUp {
@override
void warmUpOnCanvas(Canvas canvas) {
super.warmUpOnCanvas(canvas);
Future<void> warmUpOnCanvas(Canvas canvas) async {
await super.warmUpOnCanvas(canvas);
// Warm up the cubic shaders used by CubicBezierPage.
//