mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 10:41:31 +00:00
Since fetches involve multiple subprocess calls, any of which can be slow, the per-subprocess caffeination strategy does not seem suitable -- the Mac might sleep as soon as the wake lock is dropped, before it starts a new one. This instead implements a context manager to allow caffeinating a scope. To allow flag control, caffeinate.scope takes an argument that decides whether or not it should actually do anything useful; it looks silly, but the alternative is to interfere with flag parsing more or to require users to write separate codepaths to decide whether to enter the context manager scope or not; the "use the context manager in a mode where it does not do anything" prevents this. Bug: 462507017 Change-Id: Icc5bb9cadda30b5a120f112b10bf96ffd3b6550f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/7183647 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Adam Norberg <norberg@google.com>
12 KiB
Executable File
12 KiB
Executable File