Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: components/metrics/child_call_stack_profile_collector.cc

Issue 2927593002: Make stack sampling profiler sample beyond startup. (Closed)
Patch Set: Remove debug log statements. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/metrics/child_call_stack_profile_collector.cc
diff --git a/components/metrics/child_call_stack_profile_collector.cc b/components/metrics/child_call_stack_profile_collector.cc
index 52b93b2af09e0b67e98f3d23f90c47987dd8d8b8..09dc6c83eeb52772047fea84d6ab61fcb812318a 100644
--- a/components/metrics/child_call_stack_profile_collector.cc
+++ b/components/metrics/child_call_stack_profile_collector.cc
@@ -65,7 +65,19 @@ void ChildCallStackProfileCollector::SetParentProfileCollector(
profiles_.clear();
}
-void ChildCallStackProfileCollector::Collect(
+base::Optional<base::StackSamplingProfiler::SamplingParams>
+ChildCallStackProfileCollector::Collect(
+ const CallStackProfileParams& params,
+ base::TimeTicks start_timestamp,
+ std::vector<CallStackProfile> profiles) {
+ // Impl function is used as it needs to PostTask() to itself on a different
+ // thread - which only works with a void return value.
+ CollectImpl(params, start_timestamp, std::move(profiles));
+ // Empty return value indicates that collection should not be re-started.
+ return base::Optional<base::StackSamplingProfiler::SamplingParams>();
+}
+
+void ChildCallStackProfileCollector::CollectImpl(
const CallStackProfileParams& params,
base::TimeTicks start_timestamp,
std::vector<CallStackProfile> profiles) {
@@ -76,13 +88,11 @@ void ChildCallStackProfileCollector::Collect(
(!base::ThreadTaskRunnerHandle::IsSet() ||
base::ThreadTaskRunnerHandle::Get() != task_runner_)) {
// Post back to the thread that owns the the parent interface.
- task_runner_->PostTask(FROM_HERE, base::Bind(
- &ChildCallStackProfileCollector::Collect,
- // This class has lazy instance lifetime.
- base::Unretained(this),
- params,
- start_timestamp,
- base::Passed(std::move(profiles))));
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&ChildCallStackProfileCollector::CollectImpl,
+ // This class has lazy instance lifetime.
+ base::Unretained(this), params, start_timestamp,
+ base::Passed(std::move(profiles))));
return;
}

Powered by Google App Engine
This is Rietveld 408576698