diff options
author | Winson <chiuwinson@google.com> | 2020-09-29 09:57:01 -0700 |
---|---|---|
committer | Winson <chiuwinson@google.com> | 2021-05-03 10:53:26 -0700 |
commit | 288dc8fec1adb22e89369e7f2c9e60ac81978cc2 (patch) | |
tree | 4fb953629bd8a9e8f3311d6993039f3a89b9e2b2 /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | 8d3b16568adb51a4b0340a126975ad3a5f3a6600 (diff) |
Throttle package session async write requests
Previously, async writes were posted to a Handler but not throttled,
so it was possible to do redundant writes when the latest state had
already been saved.
To avoid that, a counter is stored that serves as a request ID that
can be checked against to see if the latest state has already been
saved, skipping the write request if it has.
This is preferred to calling Handler#hasCallbacks or
Handler#removeCallbacks because those will lock the Handler. And taking
the lock twice is perhaps worse than locking once to schedule a no-op
Runnable, although this was not benchmarked.
This also introduces a retry mechanism in case the write fails.
Bug: 168086110
Test: atest PackageSessionTests
Test: atest RequestThrottleTest
Change-Id: I604dc433c77cf1d9d743c8437674576ad087d62c
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions