summaryrefslogtreecommitdiffstats
path: root/chromium/base/profiler/stack_sampler_impl.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-03-12 09:13:00 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-03-16 09:58:26 +0000
commit03561cae90f1d99b5c54b1ef3be69f10e882b25e (patch)
treecc5f0958e823c044e7ae51cc0117fe51432abe5e /chromium/base/profiler/stack_sampler_impl.cc
parentfa98118a45f7e169f8846086dc2c22c49a8ba310 (diff)
BASELINE: Update Chromium to 88.0.4324.208
Change-Id: I3ae87d23e4eff4b4a469685658740a213600c667 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/base/profiler/stack_sampler_impl.cc')
-rw-r--r--chromium/base/profiler/stack_sampler_impl.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/chromium/base/profiler/stack_sampler_impl.cc b/chromium/base/profiler/stack_sampler_impl.cc
index a05b10e2705..bbe91e469e5 100644
--- a/chromium/base/profiler/stack_sampler_impl.cc
+++ b/chromium/base/profiler/stack_sampler_impl.cc
@@ -16,6 +16,7 @@
#include "base/profiler/stack_copier.h"
#include "base/profiler/suspendable_thread_delegate.h"
#include "base/profiler/unwinder.h"
+#include "base/ranges/algorithm.h"
#include "build/build_config.h"
// IMPORTANT NOTE: Some functions within this implementation are invoked while
@@ -92,10 +93,16 @@ void StackSamplerImpl::Initialize() {
for (const auto& unwinder : unwinders_)
unwinder->AddInitialModules(module_cache_);
+
+ was_initialized_ = true;
}
void StackSamplerImpl::AddAuxUnwinder(std::unique_ptr<Unwinder> unwinder) {
- unwinder->AddInitialModules(module_cache_);
+ // Initialize() invokes AddInitialModules() on the unwinders that are present
+ // at the time. If it hasn't occurred yet, we allow it to add the initial
+ // modules, otherwise we do it here.
+ if (was_initialized_)
+ unwinder->AddInitialModules(module_cache_);
unwinders_.push_front(std::move(unwinder));
}
@@ -169,11 +176,10 @@ std::vector<Frame> StackSamplerImpl::WalkStack(
do {
// Choose an authoritative unwinder for the current module. Use the first
// unwinder that thinks it can unwind from the current frame.
- auto unwinder =
- std::find_if(unwinders.begin(), unwinders.end(),
- [&stack](const std::unique_ptr<Unwinder>& unwinder) {
- return unwinder->CanUnwindFrom(stack.back());
- });
+ auto unwinder = ranges::find_if(
+ unwinders, [&stack](const std::unique_ptr<Unwinder>& unwinder) {
+ return unwinder->CanUnwindFrom(stack.back());
+ });
if (unwinder == unwinders.end())
return stack;