Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Disable chromium metrics providers #26294

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright (c) 2024 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */

#include "chrome/browser/metrics/chrome_metrics_service_client.h"

#define ChromeMetricsServiceClient ChromeMetricsServiceClient_ChromiumImpl
#include "src/chrome/browser/metrics/chrome_metrics_service_client.cc"
#undef ChromeMetricsServiceClient

void ChromeMetricsServiceClient::RegisterMetricsServiceProviders() {
// Do nothing.
}

void ChromeMetricsServiceClient::RegisterUKMProviders() {
// Do nothing.
}

ChromeMetricsServiceClient::ChromeMetricsServiceClient(
metrics::MetricsStateManager* state_manager,
variations::SyntheticTrialRegistry* synthetic_trial_registry)
: ChromeMetricsServiceClient_ChromiumImpl(state_manager,
synthetic_trial_registry) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Copyright (c) 2024 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
#ifndef BRAVE_CHROMIUM_SRC_CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
#define BRAVE_CHROMIUM_SRC_CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_

#define ChromeMetricsServiceClient ChromeMetricsServiceClient_ChromiumImpl
#define RegisterMetricsServiceProviders virtual RegisterMetricsServiceProviders
#include "src/chrome/browser/metrics/chrome_metrics_service_client.h" // IWYU pragma: export
#undef RegisterMetricsServiceProviders
#undef ChromeMetricsServiceClient

class ChromeMetricsServiceClient
: public ChromeMetricsServiceClient_ChromiumImpl {
public:
void RegisterMetricsServiceProviders() override;
void RegisterUKMProviders() override;

ChromeMetricsServiceClient(
metrics::MetricsStateManager* state_manager,
variations::SyntheticTrialRegistry* synthetic_trial_registry);

private:
// TODO: remove?
friend class ChromeMetricsServiceClientTest;
friend class ChromeMetricsServiceClientTestIgnoredForAppMetrics;
friend class ChromeMetricsServiceClientTestWithoutUKMProviders;
FRIEND_TEST_ALL_PREFIXES(ChromeMetricsServiceClientTest, IsWebstoreExtension);
};

#endif // BRAVE_CHROMIUM_SRC_CHROME_BROWSER_METRICS_CHROME_METRICS_SERVICE_CLIENT_H_
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
diff --git a/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc b/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc
index 11548a8313dc775cb9bea3bc041d896e42ce305a..bbdced4ba79bd5722b74b0639e1c2bcfa7b6f250 100644
--- a/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc
+++ b/chrome/browser/performance_manager/chrome_browser_main_extra_parts_performance_manager.cc
@@ -310,11 +310,13 @@ void ChromeBrowserMainExtraPartsPerformanceManager::PreMainMessageLoopRun() {
performance_manager::user_tuning::UserPerformanceTuningManager::GetInstance()
->Start();

+#if 0 // Disabled in Brave
// This object is created by the metrics service before threads, but it
// needs the UserPerformanceTuningManager to exist. At this point it's
// instantiated, but still needs to be initialized.
performance_manager::MetricsProviderDesktop::GetInstance()->Initialize();
#endif
+#endif
}

void ChromeBrowserMainExtraPartsPerformanceManager::PostMainMessageLoopRun() {
Loading