Commit c6661cc4 authored by gogerald's avatar gogerald Committed by Commit Bot

[Autofill Assistant] Stop recheck and retry when there is a pending script to run

Bug: 806868
Change-Id: I4e3f2340929a68423bbc3c8153c9576d243cc032
Reviewed-on: https://chromium-review.googlesource.com/c/1284649
Commit-Queue: Ganggui Tang <gogerald@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600163}
parent 087125fb
...@@ -90,11 +90,17 @@ void ScriptTracker::ExecuteScript(const std::string& script_path, ...@@ -90,11 +90,17 @@ void ScriptTracker::ExecuteScript(const std::string& script_path,
ScriptExecutor::RunScriptCallback run_script_callback = base::BindOnce( ScriptExecutor::RunScriptCallback run_script_callback = base::BindOnce(
&ScriptTracker::OnScriptRun, weak_ptr_factory_.GetWeakPtr(), script_path, &ScriptTracker::OnScriptRun, weak_ptr_factory_.GetWeakPtr(), script_path,
std::move(callback)); std::move(callback));
// Postpone running script until finishing preconditions check. // Postpone running script until finishing the current round of preconditions
// check.
if (!batch_element_checker_ && !must_recheck_) { if (!batch_element_checker_ && !must_recheck_) {
executor_->Run(std::move(run_script_callback)); executor_->Run(std::move(run_script_callback));
} else { } else {
pending_run_script_callback_ = std::move(run_script_callback); pending_run_script_callback_ = std::move(run_script_callback);
// Do not recheck and retry when there is a script pending to run. Note
// that |batch_element_checker_| may take a long time to wait on retrying
// unsatisfied preconditions check without stop trying.
must_recheck_.Reset();
batch_element_checker_->StopTrying();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment