• Brian White's avatar
    Don't create TLS vector on Get. · 2f86076a
    Brian White authored
    Previously, TLS::Slot::Get() would create the TLS vector if it doesn't
    yet exist and then return the slot value which of course is null since
    it was just created.
    
    Now, just return null instead of creating the vector.  The vector will
    be created by Set() if it doesn't exist.
    
    This allows clients to make use of an existing slot in dangerous
    situations (such as exception handling) without necessarily creating
    the underlying vector at that time.
    
    Bug: 821494
    Change-Id: I404524ec7ccf0da4ea5451eea25b49783a711c04
    Reviewed-on: https://chromium-review.googlesource.com/1007682
    Commit-Queue: Brian White <bcwhite@chromium.org>
    Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#549979}
    2f86076a
thread_local_storage.cc 16.7 KB