diff --git a/components/brave_news/browser/brave_news_p3a.cc b/components/brave_news/browser/brave_news_p3a.cc index c23daa3e0a48..e1a7fd039ee3 100644 --- a/components/brave_news/browser/brave_news_p3a.cc +++ b/components/brave_news/browser/brave_news_p3a.cc @@ -120,7 +120,7 @@ void NewsMetrics::RecordTotalActionCount(ActionType action, uint64_t count_delta) { DVLOG(1) << __FUNCTION__ << " action: " << static_cast(action) << ", count_delta: " << count_delta; - const char* pref_name; + const char* pref_name = nullptr; switch (action) { case ActionType::kCardView: pref_name = prefs::kBraveNewsTotalCardViews; @@ -131,10 +131,8 @@ void NewsMetrics::RecordTotalActionCount(ActionType action, case ActionType::kSidebarFilterUsage: pref_name = prefs::kBraveNewsTotalSidebarFilterUsages; break; - default: - NOTREACHED_IN_MIGRATION(); - return; } + CHECK(pref_name); WeeklyStorage total_storage(prefs_, pref_name); @@ -164,8 +162,6 @@ void NewsMetrics::RecordTotalActionCount(ActionType action, p3a_utils::RecordToHistogramBucket(kSidebarFilterUsageHistogramName, kSidebarFilterUsageBuckets, total); break; - default: - NOTREACHED_IN_MIGRATION(); } } @@ -204,7 +200,7 @@ void NewsMetrics::RecordTotalSubscribedCount(SubscribeType subscribe_type, subscription_counts_[subscribe_type] = *total; } - const char* histogram_name; + const char* histogram_name = nullptr; switch (subscribe_type) { case SubscribeType::kChannels: histogram_name = kChannelCountHistogramName; @@ -212,10 +208,8 @@ void NewsMetrics::RecordTotalSubscribedCount(SubscribeType subscribe_type, case SubscribeType::kPublishers: histogram_name = kPublisherCountHistogramName; break; - default: - NOTREACHED_IN_MIGRATION(); - return; } + CHECK(histogram_name); if (!IsMonthlyActiveUser()) { // Only report for active users in the past month. diff --git a/components/brave_wallet/browser/brave_wallet_p3a.cc b/components/brave_wallet/browser/brave_wallet_p3a.cc index 4291f979e172..c17d9549e610 100644 --- a/components/brave_wallet/browser/brave_wallet_p3a.cc +++ b/components/brave_wallet/browser/brave_wallet_p3a.cc @@ -147,7 +147,7 @@ void BraveWalletP3A::ReportJSProvider(mojom::JSProviderType provider_type, histogram_name = kSolProviderHistogramName; break; default: - NOTREACHED_NORETURN(); + return; } JSProviderAnswer answer = JSProviderAnswer::kNoWallet; @@ -180,8 +180,6 @@ void BraveWalletP3A::ReportJSProvider(mojom::JSProviderType provider_type, : JSProviderAnswer::kNativeNotOverridden; } break; - default: - NOTREACHED_NORETURN(); } base::UmaHistogramEnumeration(histogram_name, answer); @@ -256,12 +254,9 @@ void BraveWalletP3A::ReportTransactionSent(mojom::CoinType coin, case mojom::CoinType::ZEC: histogram_name = kZecTransactionSentHistogramName; break; - default: - NOTREACHED_IN_MIGRATION() << coin; - return; } - DCHECK(histogram_name); + CHECK(histogram_name); ScopedDictPrefUpdate last_sent_time_update( profile_prefs_, kBraveWalletLastTransactionSentTimeDict); @@ -309,12 +304,9 @@ void BraveWalletP3A::RecordActiveWalletCount(int count, case mojom::CoinType::ZEC: histogram_name = kZecActiveAccountHistogramName; break; - default: - NOTREACHED_IN_MIGRATION() << coin_type; - return; } - DCHECK(histogram_name); + CHECK(histogram_name); const base::Value::Dict& active_wallet_dict = profile_prefs_->GetDict(kBraveWalletP3AActiveWalletDict); @@ -472,7 +464,7 @@ void BraveWalletP3A::OnTransactionStatusChanged( return; } } else { - NOTREACHED_IN_MIGRATION(); + return; } ReportTransactionSent(tx_coin, true); } diff --git a/components/misc_metrics/menu_metrics.cc b/components/misc_metrics/menu_metrics.cc index edc21a03d85f..e54d7862d4c4 100644 --- a/components/misc_metrics/menu_metrics.cc +++ b/components/misc_metrics/menu_metrics.cc @@ -37,7 +37,7 @@ const char* GetMenuGroupPrefKey(MenuGroup group) { case MenuGroup::kBrowserViews: return kBrowserViewsPrefKey; } - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } } // namespace diff --git a/components/p3a/constellation_helper_unittest.cc b/components/p3a/constellation_helper_unittest.cc index 4635c228b321..f5471852b52c 100644 --- a/components/p3a/constellation_helper_unittest.cc +++ b/components/p3a/constellation_helper_unittest.cc @@ -125,7 +125,7 @@ class P3AConstellationHelperTest : public testing::Test { case MetricLogType::kExpress: return kTestExpressEpoch; } - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } const char* GetTestNextEpochTime(MetricLogType log_type) { @@ -137,7 +137,7 @@ class P3AConstellationHelperTest : public testing::Test { case MetricLogType::kExpress: return kTestExpressNextEpochTime; } - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } void CheckInfoRequestMade(MetricLogType log_type) { diff --git a/components/p3a/constellation_log_store.cc b/components/p3a/constellation_log_store.cc index faf80b1d9319..dcfa9b48711f 100644 --- a/components/p3a/constellation_log_store.cc +++ b/components/p3a/constellation_log_store.cc @@ -130,18 +130,15 @@ const std::string& ConstellationLogStore::staged_log_histogram_name() const { } const std::string& ConstellationLogStore::staged_log_hash() const { - NOTREACHED_IN_MIGRATION(); - return staged_log_hash_; + NOTREACHED(); } const std::string& ConstellationLogStore::staged_log_signature() const { - NOTREACHED_IN_MIGRATION(); - return staged_log_signature_; + NOTREACHED(); } std::optional ConstellationLogStore::staged_log_user_id() const { - NOTREACHED_IN_MIGRATION(); - return std::nullopt; + NOTREACHED(); } void ConstellationLogStore::StageNextLog() { @@ -175,7 +172,7 @@ void ConstellationLogStore::MarkStagedLogAsSent() { void ConstellationLogStore::TrimAndPersistUnsentLogs( bool overwrite_in_memory_store) { - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } size_t ConstellationLogStore::GetMaxEpochsToRetain() const { diff --git a/components/p3a/constellation_log_store_unittest.cc b/components/p3a/constellation_log_store_unittest.cc index 22388268b69b..3ac8633ff0e8 100644 --- a/components/p3a/constellation_log_store_unittest.cc +++ b/components/p3a/constellation_log_store_unittest.cc @@ -42,7 +42,7 @@ class P3AConstellationLogStoreTest : public testing::Test { case MetricLogType::kExpress: return kExpressMaxEpochsToRetain; } - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } void UpdateSomeMessages(uint8_t epoch, size_t message_count) { diff --git a/components/p3a/histograms_braveizer.cc b/components/p3a/histograms_braveizer.cc index 40d0aec157a9..f625ab6426a2 100644 --- a/components/p3a/histograms_braveizer.cc +++ b/components/p3a/histograms_braveizer.cc @@ -71,7 +71,7 @@ void HistogramsBraveizer::DoHistogramBravetization( answer = 1; break; default: - NOTREACHED_IN_MIGRATION(); + return; } UMA_HISTOGRAM_BOOLEAN("Brave.Core.IsDefault", answer); } diff --git a/components/p3a/message_manager_unittest.cc b/components/p3a/message_manager_unittest.cc index 6b7066237f86..3f82d9d94d99 100644 --- a/components/p3a/message_manager_unittest.cc +++ b/components/p3a/message_manager_unittest.cc @@ -207,7 +207,7 @@ class P3AMessageManagerTest : public testing::Test, histogram_names_end = kCollectedTypicalHistograms.cend(); break; default: - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } for (auto histogram_name_i = histogram_names_begin; histogram_name_i != histogram_names_end; histogram_name_i++) { diff --git a/components/p3a/metric_log_store.cc b/components/p3a/metric_log_store.cc index 3251111a42e2..92e11bb4eeb8 100644 --- a/components/p3a/metric_log_store.cc +++ b/components/p3a/metric_log_store.cc @@ -219,18 +219,15 @@ const std::string& MetricLogStore::staged_log_key() const { } const std::string& MetricLogStore::staged_log_hash() const { - NOTREACHED_IN_MIGRATION(); - return staged_log_hash_; + NOTREACHED(); } const std::string& MetricLogStore::staged_log_signature() const { - NOTREACHED_IN_MIGRATION(); - return staged_log_signature_; + NOTREACHED(); } std::optional MetricLogStore::staged_log_user_id() const { - NOTREACHED_IN_MIGRATION(); - return std::nullopt; + NOTREACHED(); } void MetricLogStore::StageNextLog() { @@ -277,7 +274,7 @@ void MetricLogStore::DiscardStagedLog(std::string_view reason) { void MetricLogStore::MarkStagedLogAsSent() {} void MetricLogStore::TrimAndPersistUnsentLogs(bool overwrite_in_memory_store) { - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } void MetricLogStore::LoadPersistedUnsentLogs() { diff --git a/components/p3a/metric_log_type.cc b/components/p3a/metric_log_type.cc index 9ab4d1ffc672..8de38a4661cc 100644 --- a/components/p3a/metric_log_type.cc +++ b/components/p3a/metric_log_type.cc @@ -26,7 +26,7 @@ const char* MetricLogTypeToString(MetricLogType log_type) { case MetricLogType::kExpress: return kExpressStr; } - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } std::optional StringToMetricLogType( diff --git a/components/p3a/p3a_service.cc b/components/p3a/p3a_service.cc index 4b2dcecd1f00..52f538703199 100644 --- a/components/p3a/p3a_service.cc +++ b/components/p3a/p3a_service.cc @@ -270,7 +270,6 @@ void P3AService::OnHistogramChanged(const char* histogram_name, const bool ok = samples->Iterator()->GetBucketIndex(&bucket); if (!ok) { LOG(ERROR) << "Only linear histograms are supported at the moment!"; - NOTREACHED_IN_MIGRATION(); return; } diff --git a/components/p3a/rotation_scheduler.cc b/components/p3a/rotation_scheduler.cc index 0c9ee8ee253e..d27954576cca 100644 --- a/components/p3a/rotation_scheduler.cc +++ b/components/p3a/rotation_scheduler.cc @@ -77,7 +77,7 @@ base::Time GetNextJsonRotationTime(MetricLogType log_type, case MetricLogType::kExpress: return NextDay(last_rotation); default: - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } } @@ -90,9 +90,8 @@ const char* GetJsonRotationTimestampPref(MetricLogType log_type) { case MetricLogType::kExpress: return kLastExpressJsonRotationTimeStampPref; default: - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } - return nullptr; } const char* GetConstellationRotationTimestampPref(MetricLogType log_type) { @@ -104,9 +103,8 @@ const char* GetConstellationRotationTimestampPref(MetricLogType log_type) { case MetricLogType::kExpress: return kLastExpressConstellationRotationTimeStampPref; default: - NOTREACHED_IN_MIGRATION(); + NOTREACHED(); } - return nullptr; } } // namespace