blob: 99f5e82d1efda6d750c98afcd8ec186324d8dc84 [file] [log] [blame]
// Copyright 2022 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "android_webview/browser/tracing/aw_background_tracing_metrics_provider.h"
#include "android_webview/browser/metrics/aw_metrics_service_client.h"
#include "base/strings/string_piece.h"
#include "components/metrics/field_trials_provider.h"
#include "components/metrics/metrics_service.h"
namespace tracing {
AwBackgroundTracingMetricsProvider::AwBackgroundTracingMetricsProvider() =
default;
AwBackgroundTracingMetricsProvider::~AwBackgroundTracingMetricsProvider() =
default;
void AwBackgroundTracingMetricsProvider::Init() {
BackgroundTracingMetricsProvider::Init();
// TODO(crbug.com/1290887): SetupBackgroundTracingFieldTrial() should be
// called here.
metrics::MetricsService* metrics =
android_webview::AwMetricsServiceClient::GetInstance()
->GetMetricsService();
DCHECK(metrics);
system_profile_providers_.emplace_back(
std::make_unique<variations::FieldTrialsProvider>(
metrics->synthetic_trial_registry(), base::StringPiece()));
}
void AwBackgroundTracingMetricsProvider::ProvideEmbedderMetrics(
metrics::ChromeUserMetricsExtension* uma_proto,
base::HistogramSnapshotManager* snapshot_manager) {
// Remove the package name according to the privacy requirements.
// See go/public-webview-trace-collection.
auto* system_profile = uma_proto->mutable_system_profile();
system_profile->clear_app_package_name();
}
} // namespace tracing