blink/bindings: Keep compressed ParkableStrings when unparking, and reuse it.

When a ParkableString is unparked, keep the compressed data around, allowing to
drop the uncompressed data at no cost later. As decompression is much (>10x)
cheaper than compression and compressed data smaller, this is usually a good
tradeoff. This also allows to recover memory when a string is unparked once, and
its content is not touched again soon.

Concretely, we introduce:
- "synchronous parking" when parking is merely dropping the decompressed
  representation.
- "synchronous only" string parking in ParkableStringManager
- Drop all parkable strings when receiving a OnPurgeMemory() notification.

Also, improve and simplify testing, with fewer "friend" function and tighter
compression test.

Bug: 877044
Change-Id: I4b66ca5ddc67b2a6e49bfd1790e1788870642b04
Reviewed-on: https://chromium-review.googlesource.com/c/1329975
Reviewed-by: Benoit L <lizeb@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610024}
6 files changed