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

Unified Diff: components/metrics/child_call_stack_profile_collector.cc

Issue 2927593002: Make stack sampling profiler sample beyond startup. (Closed)
Patch Set: Created 3 years, 6 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..67f2a588d5211d0aaef6d777ffaa72f3647468a0 100644
--- a/components/metrics/child_call_stack_profile_collector.cc
+++ b/components/metrics/child_call_stack_profile_collector.cc
@@ -65,7 +65,20 @@ void ChildCallStackProfileCollector::SetParentProfileCollector(
profiles_.clear();
}
-void ChildCallStackProfileCollector::Collect(
+bool ChildCallStackProfileCollector::Collect(
+ const CallStackProfileParams& params,
+ base::TimeTicks start_timestamp,
+ std::vector<CallStackProfile> profiles,
+ base::StackSamplingProfiler::SamplingParams* sampling_params) {
+ // 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));
+ // False return value indicates that collection should not be started again
+ // with modified |sampling_params|.
+ return false;
+}
+
+void ChildCallStackProfileCollector::CollectImpl(
const CallStackProfileParams& params,
base::TimeTicks start_timestamp,
std::vector<CallStackProfile> profiles) {
@@ -76,13 +89,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