-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make screenshot recorder capture() synchronous so it's hard…
…er to break accidentally with future changes (#2493) * refactor: make screenshot recorder capture() synchronous so it's harder to break accidentally with future changes * formatting * enh: add timeline callbacks * fix min_version_test * try to fix ci * try to fix ci * try to fix ci * fix recorder scheduling for screenshots & fix widget filter items carryover * fix late final usage * cleanup * fix ci * cleanup, ci fix * extract replayrecorder * test throwing in recorder task
- Loading branch information
Showing
9 changed files
with
275 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dart:async'; | ||
import 'dart:developer'; | ||
|
||
import 'package:flutter/scheduler.dart'; | ||
import 'package:meta/meta.dart'; | ||
|
||
import '../screenshot/recorder.dart'; | ||
|
||
var _instanceCounter = 0; | ||
|
||
@internal | ||
class ReplayScreenshotRecorder extends ScreenshotRecorder { | ||
ReplayScreenshotRecorder(super.config, super.options) | ||
: super( | ||
privacyOptions: options.experimental.privacyForReplay, | ||
logName: 'ReplayRecorder #${++_instanceCounter}'); | ||
|
||
@override | ||
@protected | ||
Future<void> executeTask(void Function() task, Flow flow) { | ||
// Schedule the task to run between frames, when the app is idle. | ||
return options.bindingUtils.instance | ||
?.scheduleTask<void>(task, Priority.idle, flow: flow) ?? | ||
Future.sync(task); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.