Update the floc computation scheduling pattern
Before: Schedule the computation events using a RepeatingTimer and use a session number to address potential race conditions. After: Use a flag |floc_computation_in_progress_| to guard the process from ComputeFloc to OnComputeFlocCompleted. Incoming computation will be ignored if there’s one ongoing. After each OnComputeFlocCompleted, a ComputeFloc event will be scheduled 24 hours later / override the existing scheduled event. Why: The new pattern would be more suitable for a future plan where more computation triggers are introduced (e.g. kHistoryDelete). In that case, the caller can simply call ComputeFloc(ComputeFlocTrigger::kHistoryDelete) without needing to reset the timer. Bug: 1062736 Change-Id: Ic128262272c71be3bc8998bb192ff7c7b615faa8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359394 Commit-Queue: Yao Xiao <yaoxia@chromium.org> Reviewed-by:Josh Karlin <jkarlin@chromium.org> Cr-Commit-Position: refs/heads/master@{#799547}
Showing
This diff is collapsed.
Please register or sign in to comment