Commit feb11d02 authored by Alexei Filippov's avatar Alexei Filippov Committed by Commit Bot

[heap profiler] Do not try to pass collected profile if no callback is set.

This is a quickfix for a crash when a heap profile is being reported
over UMA on Android.

BUG=973430

Change-Id: I07cf28ef18809ab82c1a447f686871f6bedb71fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1659025
Commit-Queue: Alexei Filippov <alph@chromium.org>
Auto-Submit: Alexei Filippov <alph@chromium.org>
Reviewed-by: default avatarMike Wittman <wittman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#669098}
parent 999414c8
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "base/metrics/metrics_hashes.h" #include "base/metrics/metrics_hashes.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "build/build_config.h"
#include "components/metrics/call_stack_profile_encoding.h" #include "components/metrics/call_stack_profile_encoding.h"
namespace metrics { namespace metrics {
...@@ -250,8 +251,12 @@ void CallStackProfileBuilder::SetParentProfileCollectorForChildProcess( ...@@ -250,8 +251,12 @@ void CallStackProfileBuilder::SetParentProfileCollectorForChildProcess(
void CallStackProfileBuilder::PassProfilesToMetricsProvider( void CallStackProfileBuilder::PassProfilesToMetricsProvider(
SampledProfile sampled_profile) { SampledProfile sampled_profile) {
if (sampled_profile.process() == BROWSER_PROCESS) { if (sampled_profile.process() == BROWSER_PROCESS) {
// TODO(crbug.com/973430): Remove the check once profile reporting on
// Android is sorted out.
#if !defined(OS_ANDROID)
GetBrowserProcessReceiverCallbackInstance().Run(profile_start_time_, GetBrowserProcessReceiverCallbackInstance().Run(profile_start_time_,
std::move(sampled_profile)); std::move(sampled_profile));
#endif
} else { } else {
g_child_call_stack_profile_collector.Get() g_child_call_stack_profile_collector.Get()
.ChildCallStackProfileCollector::Collect(profile_start_time_, .ChildCallStackProfileCollector::Collect(profile_start_time_,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment