avm1: Reduce frequency of timeout checks by 10+ times

This commit is contained in:
Adrian Wielgosik 2021-03-13 10:19:58 +01:00 committed by GitHub
parent d16d142c60
commit 1aa77b04fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -224,7 +224,7 @@ pub struct Activation<'a, 'gc: 'a, 'gc_context: 'a> {
target_clip: Option<DisplayObject<'gc>>, target_clip: Option<DisplayObject<'gc>>,
/// Amount of actions performed since the last timeout check /// Amount of actions performed since the last timeout check
actions_since_timeout_check: u8, actions_since_timeout_check: u16,
/// Whether the base clip was removed when we started this frame. /// Whether the base clip was removed when we started this frame.
base_clip_unloaded: bool, base_clip_unloaded: bool,
@ -449,7 +449,7 @@ impl<'a, 'gc, 'gc_context> Activation<'a, 'gc, 'gc_context> {
reader: &mut Reader<'b>, reader: &mut Reader<'b>,
) -> Result<FrameControl<'gc>, Error<'gc>> { ) -> Result<FrameControl<'gc>, Error<'gc>> {
self.actions_since_timeout_check += 1; self.actions_since_timeout_check += 1;
if self.actions_since_timeout_check >= 200 { if self.actions_since_timeout_check >= 2000 {
self.actions_since_timeout_check = 0; self.actions_since_timeout_check = 0;
if self.context.update_start.elapsed() >= self.context.max_execution_duration { if self.context.update_start.elapsed() >= self.context.max_execution_duration {
return Err(Error::ExecutionTimeout); return Err(Error::ExecutionTimeout);