• Wez's avatar
    Revert "Simplified and optimized StatisticsRecorder." · 4c009ba6
    Wez authored
    This reverts commit b86ebc88.
    
    Reason for revert: Introduces flakiness due to removal of global StatisticsRecorder teardown - see crbug.com/798717. This is a cross-platyform issue but in practice only caused base_unittests failures on the Fuchsia FYI bots, presumably due to differences in test ordering.
    
    Original change's description:
    > Simplified and optimized StatisticsRecorder.
    > 
    > StatisticsRecorder is now an actual container of collections.
    > 
    > There is only one global recorder at any time, referenced by
    > StatisticsRecorder::top_.
    > 
    > Each StatisticsRecorder also has a pointer to the previous global recorder.
    > 
    > We now have a stack (singly linked list) of StatisticsRecorder objects, where
    > the top of the stack (StatisticsRecorder::top_) is the current global recorder.
    > 
    > This pattern is clearer and cleaner. It avoids a bunch of static variables,
    > indirections, unique_ptrs and calls to operator new. It gets rid of the ugly
    > hacks of UninitializeForTesting. It reduces memory fragmentation by having fewer
    > dynamically allocated objects.
    > 
    > Removed methods Reset, UninitializeForTesting and DumpHistogramsToVlog. They are
    > now unnecessary.
    > 
    > Reviewed, clarified and documented the thread safety status of each method.
    > 
    > Added comments.
    > 
    > 
    > Change-Id: Ia1a7611905009d0449068c801464ad0df7813c0d
    > Bug: 
    > Reviewed-on: https://chromium-review.googlesource.com/830997
    > Commit-Queue: François Degros <fdegros@chromium.org>
    > Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#526570}
    
    TBR=asvitkine@chromium.org,gayane@chromium.org,holte@chromium.org,skare@chromium.org,fdegros@chromium.org
    
    Change-Id: I4bd60c636a821bf681eb452636ade1098d3a4899
    No-Presubmit: true
    No-Tree-Checks: true
    No-Try: true
    Reviewed-on: https://chromium-review.googlesource.com/848273Reviewed-by: default avatarWez <wez@chromium.org>
    Commit-Queue: Wez <wez@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#526718}
    4c009ba6
statistics_recorder.cc 15.7 KB