Add Reclaim Support to ThreadLocalStorage

Previously, ThreadLocalStorage::StaticSlot::Free() did not actually
release the corresponding ThreadLocalStorage slot. It simply cleared
out the slot and did not reuse it. As a result, each process had a
finite number of calls to ThreadLocalStorage::StaticSlot::Initialize()
before running out of slots.

This problem would manifest itself in tests where a single process runs
many tests that each do their own initialization and uninitialization.
Tests that involve TLS usage caused the process to run out of TLS slots
because there was no free support in ThreadLocalStorage.

This change adds in free support by doing what most operating systems
do, lock and track metadata in an array.

BUG=590907

Committed: https://crrev.com/783d1f9630c86d816669ab23981d0f3722c96808
Review-Url: https://codereview.chromium.org/2363783002
Cr-Original-Commit-Position: refs/heads/master@{#421320}
Cr-Commit-Position: refs/heads/master@{#423911}


CrOS-Libchrome-Original-Commit: 45609b5403d73864e5119cd5084bd6f9c7f62076
2 files changed
tree: cbe91062b42286febd153fa7cf4a74c247c4b86d
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/