• fdoray's avatar
    Reuse ThreadData instances associated with terminated named threads. · f607a846
    fdoray authored
    With this CL, whenever a thread is terminated, its ThreadData is added
    to a retired list. When a thread which doesn't have a ThreadData yet
    needs one, we first check if a ThreadData from the retired list could be
    reused. A ThreadData can be reused if it was previously associated with
    a thread that had the same name as the current thread, ignoring trailing
    digits. If no ThreadData can be reused, a new one is allocated.
    
    This change is important because TaskScheduler tears down its named
    threads when they aren't used for a while and recreates them when they
    are needed. We don't want this behavior to increase the number of
    ThreadData instances in the process indefinitely over time.
    
    BUG=645196
    CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation
    
    Review-Url: https://codereview.chromium.org/2488073002
    Cr-Commit-Position: refs/heads/master@{#436745}
    f607a846
tracked_objects_unittest.cc 53.3 KB