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..f3c40df0e1e7b16bd3b033293dddc8b9126bfc5f 100644 |
--- a/components/metrics/child_call_stack_profile_collector.cc |
+++ b/components/metrics/child_call_stack_profile_collector.cc |
@@ -21,6 +21,7 @@ ChildCallStackProfileCollector::ProfilesState::ProfilesState(ProfilesState&&) = |
ChildCallStackProfileCollector::ProfilesState::ProfilesState( |
const CallStackProfileParams& params, |
+ |
Mike Wittman
2017/07/06 17:25:53
nit: remove
Alexei Svitkine (slow)
2017/07/06 19:36:26
Done.
|
base::TimeTicks start_timestamp, |
base::StackSamplingProfiler::CallStackProfiles profiles) |
: params(params), |
@@ -65,7 +66,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 +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; |
} |