Files
cromite/build/patches/Disable-all-predictors-code.patch
T
2026-01-19 14:09:28 +01:00

1722 lines
85 KiB
Diff

From: uazo <uazo@users.noreply.github.com>
Date: Tue, 25 Jan 2022 12:22:52 +0000
Subject: Disable all predictors code
Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/browser/BUILD.gn | 3 ---
.../background_download_service_factory.cc | 2 +-
.../preloading_model_keyed_service.cc | 3 +++
.../preloading_model_keyed_service_factory.cc | 4 +---
.../optimization_guide/chrome_hints_manager.cc | 1 +
.../model_validator_keyed_service.cc | 6 +++++-
.../optimization_guide_keyed_service.cc | 1 -
.../password_change_delegate_impl.cc | 2 ++
chrome/browser/permissions/BUILD.gn | 2 --
.../permissions/chrome_permissions_client.cc | 2 --
.../passage_embedder_delegate.cc | 2 ++
.../permissions_ai_ui_selector.cc | 5 +++++
.../permissions_ai_ui_selector.h | 5 ++++-
.../prediction_model_handler_provider.cc | 12 +++++++++---
.../prediction_model_handler_provider.h | 2 ++
.../quiet_notification_permission_ui_state.cc | 4 ++--
.../autocomplete_action_predictor.cc | 2 ++
.../predictors/loading_predictor_config.cc | 4 ++--
.../browser/predictors/predictors_features.cc | 3 +--
.../search_prefetch/field_trial_settings.cc | 4 ++++
.../search_prefetch_url_loader_interceptor.cc | 1 +
...chrome_browser_main_extra_parts_profiles.cc | 1 -
chrome/browser/safe_browsing/BUILD.gn | 1 -
...cation_content_detection_service_factory.cc | 6 ++++++
.../preloading/AndroidPrerenderManager.java | 1 +
.../ui/autofill/chrome_autofill_client.cc | 13 +------------
chrome/browser/ui/tab_helpers.cc | 1 -
.../autofill_ml_internals_page_handler.cc | 2 ++
.../autofill_ml_internals_page_handler.h | 3 +++
.../autofill_ml_internals_ui.cc | 3 +++
.../read_anything/read_aloud_app_model.cc | 16 ++++++++++++++--
.../read_anything/read_aloud_app_model.h | 9 ++++++++-
.../read_anything_app_controller.cc | 10 ++++++++++
.../read_anything_app_controller.h | 4 ++++
chrome/test/BUILD.gn | 2 --
chrome/utility/BUILD.gn | 2 +-
chrome/utility/services.cc | 8 --------
components/BUILD.gn | 2 +-
.../browser/foundations/autofill_manager.cc | 6 ++++++
.../browser/foundations/autofill_manager.h | 3 +++
.../autofill_optimization_guide_decider.cc | 5 +++--
.../field_classification_model_handler.cc | 12 ++++++++----
.../field_classification_model_handler.h | 10 ++++++++--
.../aim_eligibility_service_features.cc | 1 +
.../omnibox/browser/autocomplete_controller.cc | 4 ++++
.../omnibox/browser/base_search_provider.cc | 4 ++--
.../prediction_model_download_manager.cc | 6 ++++--
.../delivery/prediction_model_fetcher_impl.cc | 1 +
.../core/hints/hints_fetcher.cc | 1 +
.../core/hints/hints_manager.cc | 2 ++
.../core/optimization_guide_features.cc | 11 +++++------
components/optimization_guide/features.gni | 3 +--
.../core/page_content_annotations_features.cc | 7 +++++++
.../page_content_annotations_model_manager.cc | 1 +
.../notification_content_detection/BUILD.gn | 4 ----
components/viz/service/BUILD.gn | 4 ++--
components/viz/service/gl/gpu_service_impl.cc | 18 ------------------
content/browser/BUILD.gn | 6 +++---
content/browser/gpu/gpu_process_host.cc | 6 +++---
.../service_worker_main_resource_loader.cc | 1 +
.../Disable-all-predictors-code.inc | 2 ++
.../Disable-all-predictors-code.inc | 1 +
.../Disable-all-predictors-code.inc | 1 +
.../Disable-all-predictors-code.inc | 1 +
.../Disable-all-predictors-code.inc | 5 +++++
.../Disable-all-predictors-code.inc | 1 +
.../Disable-all-predictors-code.inc | 1 +
.../Disable-all-predictors-code.inc | 2 ++
media/webrtc/BUILD.gn | 5 +++++
media/webrtc/helpers.cc | 3 ++-
services/on_device_model/ml/BUILD.gn | 2 +-
services/on_device_model/ml/ts_model.cc | 4 ++--
services/on_device_model/safety/BUILD.gn | 2 +-
services/webnn/BUILD.gn | 2 +-
services/webnn/features.gni | 2 +-
services/webnn/webnn_context_provider_impl.cc | 13 +------------
.../core/html/parser/html_document_parser.cc | 1 +
.../document_speculation_rules.cc | 1 +
.../platform/runtime_enabled_features.json5 | 2 +-
79 files changed, 198 insertions(+), 123 deletions(-)
create mode 100644 cromite_flags/chrome/browser/browser_features_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/chrome/common/chrome_features_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/components/password_manager/core/browser/features/password_features_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/components/permissions/features_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/net/base/features_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/services/network/public/cpp/features_cc/Disable-all-predictors-code.inc
create mode 100644 cromite_flags/third_party/blink/common/features_cc/Disable-all-predictors-code.inc
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -731,8 +731,6 @@ static_library("browser") {
"navigation_predictor/navigation_predictor_keyed_service_factory.h",
"navigation_predictor/navigation_predictor_metrics_document_data.cc",
"navigation_predictor/navigation_predictor_metrics_document_data.h",
- "navigation_predictor/navigation_predictor_preconnect_client.cc",
- "navigation_predictor/navigation_predictor_preconnect_client.h",
"navigation_predictor/preloading_model_keyed_service.cc",
"navigation_predictor/preloading_model_keyed_service.h",
"navigation_predictor/preloading_model_keyed_service_factory.cc",
@@ -2364,7 +2362,6 @@ static_library("browser") {
"//components/resources",
"//components/safe_browsing/content/browser",
"//components/safe_browsing/content/browser:safe_browsing_service",
- "//components/safe_browsing/content/browser/notification_content_detection",
"//components/safe_browsing/content/browser/password_protection",
"//components/safe_browsing/content/browser/web_ui",
"//components/safe_browsing/content/common/proto:download_file_types_proto",
diff --git a/chrome/browser/download/background_download_service_factory.cc b/chrome/browser/download/background_download_service_factory.cc
--- a/chrome/browser/download/background_download_service_factory.cc
+++ b/chrome/browser/download/background_download_service_factory.cc
@@ -179,7 +179,7 @@ BackgroundDownloadServiceFactory::BuildServiceInstanceFor(
}
#endif // BUILDFLAG(IS_CHROMEOS)
- if (!key->IsOffTheRecord()) {
+ if (((false)) && !key->IsOffTheRecord()) {
clients->insert(std::make_pair(
download::DownloadClient::OPTIMIZATION_GUIDE_PREDICTION_MODELS,
std::make_unique<download::DeferredClientWrapper>(
diff --git a/chrome/browser/navigation_predictor/preloading_model_keyed_service.cc b/chrome/browser/navigation_predictor/preloading_model_keyed_service.cc
--- a/chrome/browser/navigation_predictor/preloading_model_keyed_service.cc
+++ b/chrome/browser/navigation_predictor/preloading_model_keyed_service.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/navigation_predictor/preloading_model_handler.h"
#endif
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
namespace {
// The model takes all of its inputs as floats, so this is a convenience
@@ -28,6 +29,7 @@ constexpr float ToInput(base::TimeDelta val) {
static_assert(1.0f == ToInput(true));
} // namespace
+#endif
PreloadingModelKeyedService::Inputs::Inputs() = default;
PreloadingModelKeyedService::Inputs::Inputs(const Inputs& other) = default;
@@ -37,6 +39,7 @@ PreloadingModelKeyedService::Inputs::operator=(const Inputs& other) = default;
PreloadingModelKeyedService::PreloadingModelKeyedService(
OptimizationGuideKeyedService* optimization_guide_keyed_service) {
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
+#error BUILD_WITH_TFLITE_LIB must be disabled
auto* model_provider =
static_cast<optimization_guide::OptimizationGuideModelProvider*>(
optimization_guide_keyed_service);
diff --git a/chrome/browser/navigation_predictor/preloading_model_keyed_service_factory.cc b/chrome/browser/navigation_predictor/preloading_model_keyed_service_factory.cc
--- a/chrome/browser/navigation_predictor/preloading_model_keyed_service_factory.cc
+++ b/chrome/browser/navigation_predictor/preloading_model_keyed_service_factory.cc
@@ -42,7 +42,5 @@ std::unique_ptr<KeyedService>
blink::features::kPreloadingHeuristicsMLModel)) {
return nullptr;
}
- auto* profile = Profile::FromBrowserContext(context);
- return std::make_unique<PreloadingModelKeyedService>(
- OptimizationGuideKeyedServiceFactory::GetForProfile(profile));
+ return nullptr;
}
diff --git a/chrome/browser/optimization_guide/chrome_hints_manager.cc b/chrome/browser/optimization_guide/chrome_hints_manager.cc
--- a/chrome/browser/optimization_guide/chrome_hints_manager.cc
+++ b/chrome/browser/optimization_guide/chrome_hints_manager.cc
@@ -25,6 +25,7 @@ namespace {
// Returns true if we can make a request for hints for |prediction|.
bool IsAllowedToFetchForNavigationPrediction(
const NavigationPredictorKeyedService::Prediction& prediction) {
+ if ((true)) return false;
if (prediction.prediction_source() !=
NavigationPredictorKeyedService::PredictionSource::
kAnchorElementsParsedFromWebPage) {
diff --git a/chrome/browser/optimization_guide/model_validator_keyed_service.cc b/chrome/browser/optimization_guide/model_validator_keyed_service.cc
--- a/chrome/browser/optimization_guide/model_validator_keyed_service.cc
+++ b/chrome/browser/optimization_guide/model_validator_keyed_service.cc
@@ -69,13 +69,13 @@ namespace optimization_guide {
ModelValidatorKeyedService::ModelValidatorKeyedService(Profile* profile)
: profile_(profile) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
DCHECK(ShouldStartModelValidator());
auto* opt_guide_service =
OptimizationGuideKeyedServiceFactory::GetForProfile(profile);
if (!opt_guide_service) {
return;
}
-#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (switches::ShouldValidateModel()) {
// Create the validator object which will get destroyed when the model
// load is complete.
@@ -136,6 +136,7 @@ void ModelValidatorKeyedService::OnPrimaryAccountChanged(
void ModelValidatorKeyedService::StartModelExecutionValidation() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
auto* opt_guide_service =
OptimizationGuideKeyedServiceFactory::GetForProfile(profile_);
if (!opt_guide_service) {
@@ -154,6 +155,7 @@ void ModelValidatorKeyedService::StartModelExecutionValidation() {
/*options=*/{},
base::BindOnce(&ModelValidatorKeyedService::OnModelExecuteResponse,
weak_ptr_factory_.GetWeakPtr()));
+#endif
}
void ModelValidatorKeyedService::StartOnDeviceModelExecutionValidation(
@@ -171,6 +173,7 @@ void ModelValidatorKeyedService::StartOnDeviceModelExecutionValidation(
void ModelValidatorKeyedService::PerformOnDeviceModelExecutionValidation(
std::unique_ptr<optimization_guide::proto::ModelValidationInput> input) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
auto* opt_guide_service =
OptimizationGuideKeyedServiceFactory::GetForProfile(profile_);
@@ -218,6 +221,7 @@ void ModelValidatorKeyedService::ExecuteModel(
*metadata, base::BindRepeating(
&ModelValidatorKeyedService::OnDeviceModelExecuteResponse,
weak_ptr_factory_.GetWeakPtr(), std::move(request)));
+#endif
}
void ModelValidatorKeyedService::OnDeviceModelExecuteResponse(
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
--- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
+++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
@@ -420,7 +420,6 @@ void OptimizationGuideKeyedService::RemoveObserverForOptimizationTargetModel(
void OptimizationGuideKeyedService::RegisterOptimizationTypes(
const std::vector<optimization_guide::proto::OptimizationType>&
optimization_types) {
- hints_manager_->RegisterOptimizationTypes(optimization_types);
}
optimization_guide::OptimizationGuideDecision
diff --git a/chrome/browser/password_manager/password_change_delegate_impl.cc b/chrome/browser/password_manager/password_change_delegate_impl.cc
--- a/chrome/browser/password_manager/password_change_delegate_impl.cc
+++ b/chrome/browser/password_manager/password_change_delegate_impl.cc
@@ -353,11 +353,13 @@ void PasswordChangeDelegateImpl::StartPasswordChangeFlow() {
// a local ML model for field classification.
// TODO(452883239): Clean this up when model is downloaded on start-up for
// everybody.
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (base::FeatureList::IsEnabled(
password_manager::features::kDownloadModelForPasswordChange)) {
PasswordFieldClassificationModelHandlerFactory::GetForBrowserContext(
originator_->GetBrowserContext());
}
+#endif
}
void PasswordChangeDelegateImpl::OnLoginStateCheckResult(
diff --git a/chrome/browser/permissions/BUILD.gn b/chrome/browser/permissions/BUILD.gn
--- a/chrome/browser/permissions/BUILD.gn
+++ b/chrome/browser/permissions/BUILD.gn
@@ -42,8 +42,6 @@ source_set("permissions") {
"prediction_service/language_detection_observer.h",
"prediction_service/passage_embedder_delegate.cc",
"prediction_service/passage_embedder_delegate.h",
- "prediction_service/permissions_ai_ui_selector.cc",
- "prediction_service/permissions_ai_ui_selector.h",
"prediction_service/prediction_model_handler_provider.cc",
"prediction_service/prediction_model_handler_provider.h",
"prediction_service/prediction_service_factory.cc",
diff --git a/chrome/browser/permissions/chrome_permissions_client.cc b/chrome/browser/permissions/chrome_permissions_client.cc
--- a/chrome/browser/permissions/chrome_permissions_client.cc
+++ b/chrome/browser/permissions/chrome_permissions_client.cc
@@ -482,8 +482,6 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
#endif
selectors.emplace_back(std::make_unique<PrefBasedQuietPermissionUiSelector>(
Profile::FromBrowserContext(browser_context)));
- selectors.emplace_back(std::make_unique<PermissionsAiUiSelector>(
- Profile::FromBrowserContext(browser_context)));
return selectors;
}
diff --git a/chrome/browser/permissions/prediction_service/passage_embedder_delegate.cc b/chrome/browser/permissions/prediction_service/passage_embedder_delegate.cc
--- a/chrome/browser/permissions/prediction_service/passage_embedder_delegate.cc
+++ b/chrome/browser/permissions/prediction_service/passage_embedder_delegate.cc
@@ -17,6 +17,7 @@ PassageEmbedderDelegate::PassageEmbedderDelegate(Profile* profile)
: profile_(profile) {}
Embedder* PassageEmbedderDelegate::get_passage_embedder() {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (auto* prediction_model_handler_provider =
PredictionModelHandlerProviderFactory::GetForBrowserContext(
profile_)) {
@@ -30,6 +31,7 @@ Embedder* PassageEmbedderDelegate::get_passage_embedder() {
return prediction_model_handler_provider->GetPassageEmbedder();
}
PermissionUmaUtil::RecordPassageEmbedderMetadataValid(false);
+#endif
return nullptr;
}
diff --git a/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.cc b/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.cc
--- a/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.cc
+++ b/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.cc
@@ -434,6 +434,7 @@ void PermissionsAiUiSelector::SelectUiToUse(
}
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void PermissionsAiUiSelector::OnGetInnerTextForOnDeviceModel(
ModelExecutionData model_data,
ModelExecutionCallback model_execution_callback,
@@ -481,6 +482,7 @@ void PermissionsAiUiSelector::OnGetInnerTextForOnDeviceModel(
InquireServerModel(model_data.features,
std::move(model_data.request_metadata));
}
+#endif
void PermissionsAiUiSelector::OnTimeout() {
VLOG(1) << "[CPSS] Overall timeout for prediction reached.";
@@ -697,6 +699,7 @@ bool PermissionsAiUiSelector::ShouldHoldBack(
PredictionSource PermissionsAiUiSelector::GetPredictionTypeToUse(
permissions::RequestType request_type) {
+ if ((true)) return PredictionSource::kNoCpssModel;
const bool is_msbb_enabled = profile_->GetPrefs()->GetBoolean(
unified_consent::prefs::kUrlKeyedAnonymizedDataCollectionEnabled);
@@ -773,6 +776,7 @@ PredictionSource PermissionsAiUiSelector::GetPredictionTypeToUse(
return PredictionSource::kNoCpssModel;
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void PermissionsAiUiSelector::set_language_detection_observer_for_testing(
std::unique_ptr<permissions::LanguageDetectionObserver>
language_detection_observer) {
@@ -785,6 +789,7 @@ void PermissionsAiUiSelector::set_inner_text_for_testing(
CHECK_IS_TEST();
inner_text_for_testing_ = std::move(inner_text_);
}
+#endif
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void PermissionsAiUiSelector::set_snapshot_for_testing(SkBitmap snapshot) {
diff --git a/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.h b/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.h
--- a/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.h
+++ b/chrome/browser/permissions/prediction_service/permissions_ai_ui_selector.h
@@ -118,13 +118,14 @@ class PermissionsAiUiSelector : public permissions::PermissionUiSelector {
void set_snapshot_for_testing(SkBitmap snapshot);
#endif
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void set_inner_text_for_testing(
content_extraction::InnerTextResult inner_text);
void set_language_detection_observer_for_testing(
std::unique_ptr<permissions::LanguageDetectionObserver>
language_detection_observer);
-
+#endif
void set_callback_for_testing(DecisionMadeCallback callback) {
callback_ = std::move(callback);
}
@@ -175,10 +176,12 @@ class PermissionsAiUiSelector : public permissions::PermissionUiSelector {
// later. When the text is fetched asynchronously with success,
// model_execution_callback will get called to continue the chain of
// asynchronously added input data.
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void OnGetInnerTextForOnDeviceModel(
ModelExecutionData model_data,
ModelExecutionCallback model_execution_callback,
std::unique_ptr<content_extraction::InnerTextResult> result);
+#endif
bool ShouldHoldBack(const PredictionRequestMetadata& request_metadata) const;
diff --git a/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.cc b/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.cc
--- a/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.cc
+++ b/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.cc
@@ -13,15 +13,16 @@
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
#include "components/optimization_guide/core/delivery/optimization_guide_model_provider.h"
#include "components/permissions/features.h"
+#include "components/permissions/request_type.h"
+
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "components/permissions/prediction_service/permissions_aiv3_handler.h"
#include "components/permissions/prediction_service/permissions_aiv4_handler.h"
-#include "components/permissions/request_type.h"
#if BUILDFLAG(IS_ANDROID)
#include "components/download/public/background_service/download_params.h"
#endif
-#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "components/permissions/prediction_service/prediction_model_handler.h"
#endif // BUILDFLAG(BUILD_WITH_TFLITE_LIB)
@@ -31,6 +32,7 @@ using optimization_guide::proto::OptimizationTarget;
namespace {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
inline OptimizationTarget getGeolocationAiv4OptTarget() {
#if BUILDFLAG(IS_ANDROID)
return OptimizationTarget::
@@ -49,6 +51,7 @@ inline OptimizationTarget getNotificationsAiv4OptTarget() {
OPTIMIZATION_TARGET_PERMISSIONS_AIV4_NOTIFICATIONS_DESKTOP;
#endif
}
+#endif
} // namespace
@@ -56,7 +59,10 @@ PredictionModelHandlerProvider::PredictionModelHandlerProvider(
OptimizationGuideKeyedService* optimization_guide,
passage_embeddings::EmbedderMetadataProvider* embedder_metadata_provider,
passage_embeddings::Embedder* passage_embedder)
- : passage_embedder_(passage_embedder) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
+ : passage_embedder_(passage_embedder)
+#endif
+ {
VLOG(1) << "[PermissionsAI] PredictionModelHandlerProvider ctor "
"passage_embedder available: "
<< (passage_embedder ? "true" : "false");
diff --git a/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.h b/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.h
--- a/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.h
+++ b/chrome/browser/permissions/prediction_service/prediction_model_handler_provider.h
@@ -55,9 +55,11 @@ class PredictionModelHandlerProvider
#endif // BUILDFLAG(BUILD_WITH_TFLITE_LIB)
private:
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// EmbedderMetadataObserver:
void EmbedderMetadataUpdated(
passage_embeddings::EmbedderMetadata metadata) override;
+#endif
#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
std::unique_ptr<PredictionModelHandler>
diff --git a/chrome/browser/permissions/quiet_notification_permission_ui_state.cc b/chrome/browser/permissions/quiet_notification_permission_ui_state.cc
--- a/chrome/browser/permissions/quiet_notification_permission_ui_state.cc
+++ b/chrome/browser/permissions/quiet_notification_permission_ui_state.cc
@@ -25,9 +25,9 @@ void QuietNotificationPermissionUiState::RegisterProfilePrefs(
registry->RegisterTimePref(prefs::kQuietNotificationPermissionUiDisabledTime,
base::Time());
registry->RegisterBooleanPref(prefs::kEnableNotificationCPSS,
- /*default_value=*/true);
+ /*default_value=*/false);
registry->RegisterBooleanPref(prefs::kEnableGeolocationCPSS,
- /*default_value=*/true);
+ /*default_value=*/false);
registry->RegisterBooleanPref(
prefs::kDidMigrateAdaptiveNotifiationQuietingToCPSS,
/*default_value=*/false);
diff --git a/chrome/browser/predictors/autocomplete_action_predictor.cc b/chrome/browser/predictors/autocomplete_action_predictor.cc
--- a/chrome/browser/predictors/autocomplete_action_predictor.cc
+++ b/chrome/browser/predictors/autocomplete_action_predictor.cc
@@ -211,6 +211,8 @@ void AutocompleteActionPredictor::StartPrerendering(
SetIsNavigationInDomainCallback(preloading_data);
+ if ((true)) return; // was kOmniboxTriggerForPrerender2
+
// Create new PreloadingAttempt and pass all the values corresponding to this
// prerendering attempt for Prerender.
content::PreloadingAttempt* preloading_attempt =
diff --git a/chrome/browser/predictors/loading_predictor_config.cc b/chrome/browser/predictors/loading_predictor_config.cc
--- a/chrome/browser/predictors/loading_predictor_config.cc
+++ b/chrome/browser/predictors/loading_predictor_config.cc
@@ -13,8 +13,8 @@
namespace predictors {
bool IsLoadingPredictorEnabled(Profile* profile) {
- // Disabled for off-the-record. Policy choice, not a technical limitation.
- return profile && !profile->IsOffTheRecord();
+ // Disabled for all profiles
+ return false;
}
bool IsPreconnectAllowed(Profile* profile) {
diff --git a/chrome/browser/predictors/predictors_features.cc b/chrome/browser/predictors/predictors_features.cc
--- a/chrome/browser/predictors/predictors_features.cc
+++ b/chrome/browser/predictors/predictors_features.cc
@@ -12,8 +12,7 @@ namespace features {
namespace {
constexpr base::FeatureState kFeatureEnabledOnlyOnAndroid =
- BUILDFLAG(IS_ANDROID) ? base::FEATURE_ENABLED_BY_DEFAULT
- : base::FEATURE_DISABLED_BY_DEFAULT;
+ base::FEATURE_DISABLED_BY_DEFAULT;
} // namespace
diff --git a/chrome/browser/preloading/prefetch/search_prefetch/field_trial_settings.cc b/chrome/browser/preloading/prefetch/search_prefetch/field_trial_settings.cc
--- a/chrome/browser/preloading/prefetch/search_prefetch/field_trial_settings.cc
+++ b/chrome/browser/preloading/prefetch/search_prefetch/field_trial_settings.cc
@@ -148,3 +148,7 @@ const base::FeatureParam<base::TimeDelta>
kSuppressesSearchPrefetchOnSlowNetworkThreshold{
&kSuppressesSearchPrefetchOnSlowNetwork,
"slow_network_threshold_for_search_prefetch", base::Milliseconds(208)};
+
+SET_CROMITE_FEATURE_DISABLED(kSearchPrefetchServicePrefetching);
+SET_CROMITE_FEATURE_DISABLED(kSearchPrefetchWithNoVarySearchDiskCache);
+SET_CROMITE_FEATURE_DISABLED(kSearchNavigationPrefetch);
diff --git a/chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.cc b/chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.cc
--- a/chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.cc
+++ b/chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.cc
@@ -84,6 +84,7 @@ SearchPrefetchURLLoader::RequestHandler
SearchPrefetchURLLoaderInterceptor::MaybeCreateLoaderForRequest(
const network::ResourceRequest& tentative_resource_request,
content::FrameTreeNodeId frame_tree_node_id) {
+ if ((true)) return {};
// Do not intercept non-main frame navigations.
if (!tentative_resource_request.is_outermost_main_frame) {
// Use the is_outermost_main_frame flag instead of obtaining the
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -1217,7 +1217,6 @@ void ChromeBrowserMainExtraPartsProfiles::
#else
policy::UserPolicySigninServiceFactory::GetInstance();
#endif
- PredictionModelHandlerProviderFactory::GetInstance();
PredictionServiceFactory::GetInstance();
predictors::AutocompleteActionPredictorFactory::GetInstance();
predictors::LoadingPredictorFactory::GetInstance();
diff --git a/chrome/browser/safe_browsing/BUILD.gn b/chrome/browser/safe_browsing/BUILD.gn
--- a/chrome/browser/safe_browsing/BUILD.gn
+++ b/chrome/browser/safe_browsing/BUILD.gn
@@ -54,7 +54,6 @@ static_library("safe_browsing") {
"//components/resources:components_resources_grit",
"//components/safe_browsing:buildflags",
"//components/safe_browsing/content/browser",
- "//components/safe_browsing/content/browser/notification_content_detection",
"//components/safe_browsing/content/browser/triggers:suspicious_site_trigger",
"//components/safe_browsing/content/browser/web_ui",
"//components/safe_browsing/core/browser",
diff --git a/chrome/browser/safe_browsing/notification_content_detection/notification_content_detection_service_factory.cc b/chrome/browser/safe_browsing/notification_content_detection/notification_content_detection_service_factory.cc
--- a/chrome/browser/safe_browsing/notification_content_detection/notification_content_detection_service_factory.cc
+++ b/chrome/browser/safe_browsing/notification_content_detection/notification_content_detection_service_factory.cc
@@ -16,6 +16,7 @@
#include "components/safe_browsing/content/browser/notification_content_detection/notification_content_detection_service.h"
#include "components/safe_browsing/core/browser/db/database_manager.h"
#include "components/safe_browsing/core/common/features.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "content/public/browser/browser_context.h"
namespace safe_browsing {
@@ -51,6 +52,7 @@ NotificationContentDetectionServiceFactory::
std::unique_ptr<KeyedService> NotificationContentDetectionServiceFactory::
BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const {
+ if ((true)) return nullptr;
auto* opt_guide = OptimizationGuideKeyedServiceFactory::GetForProfile(
Profile::FromBrowserContext(context));
if (!opt_guide) {
@@ -82,6 +84,7 @@ NotificationContentDetectionServiceFactory::
content::BrowserContext* context) const {
CHECK(opt_guide);
CHECK(context);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
auto database_manager =
g_browser_process->safe_browsing_service()->database_manager();
scoped_refptr<base::SequencedTaskRunner> background_task_runner =
@@ -89,6 +92,9 @@ NotificationContentDetectionServiceFactory::
{base::MayBlock(), base::TaskPriority::BEST_EFFORT});
return std::make_unique<NotificationContentDetectionService>(
opt_guide, background_task_runner, database_manager, context);
+#else
+ return nullptr;
+#endif
}
} // namespace safe_browsing
diff --git a/chrome/browser/ui/android/preloading/java/src/org/chromium/chrome/browser/preloading/AndroidPrerenderManager.java b/chrome/browser/ui/android/preloading/java/src/org/chromium/chrome/browser/preloading/AndroidPrerenderManager.java
--- a/chrome/browser/ui/android/preloading/java/src/org/chromium/chrome/browser/preloading/AndroidPrerenderManager.java
+++ b/chrome/browser/ui/android/preloading/java/src/org/chromium/chrome/browser/preloading/AndroidPrerenderManager.java
@@ -91,6 +91,7 @@ public class AndroidPrerenderManager {
* @param prerenderUrl The url to be prerendered.
*/
public void startPrerendering(GURL prerenderUrl) {
+ if ((true)) return;
if (mNativeAndroidPrerenderManager == 0 || mTab == null) return;
AndroidPrerenderManagerJni.get()
.startPrerendering(mNativeAndroidPrerenderManager, prerenderUrl, mTab);
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -564,7 +564,7 @@ void ChromeAutofillClient::GetAiPageContent(GetAiPageContentCallback callback) {
}
AutofillAiManager* ChromeAutofillClient::GetAutofillAiManager() {
- return autofill_ai_manager_.get();
+ return nullptr;
}
AutofillAiModelCache* ChromeAutofillClient::GetAutofillAiModelCache() {
@@ -1384,18 +1384,7 @@ void ChromeAutofillClient::TriggerPlusAddressUserPerceptionSurvey(
optimization_guide::ModelQualityLogsUploaderService*
ChromeAutofillClient::GetMqlsUploadService() {
-#if !BUILDFLAG(IS_ANDROID)
- Profile* profile =
- Profile::FromBrowserContext(web_contents()->GetBrowserContext());
- OptimizationGuideKeyedService* optimization_guide_keyed_service =
- OptimizationGuideKeyedServiceFactory::GetForProfile(profile);
- if (!optimization_guide_keyed_service) {
- return nullptr;
- }
- return optimization_guide_keyed_service->GetModelQualityLogsUploaderService();
-#else
return nullptr;
-#endif
}
void ChromeAutofillClient::ShowEntityImportBubble(
diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc
--- a/chrome/browser/ui/tab_helpers.cc
+++ b/chrome/browser/ui/tab_helpers.cc
@@ -464,7 +464,6 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) {
}
MixedContentSettingsTabHelper::CreateForWebContents(web_contents);
NavigationMetricsRecorder::CreateForWebContents(web_contents);
- NavigationPredictorPreconnectClient::CreateForWebContents(web_contents);
OpenerHeuristicService::Get(web_contents->GetBrowserContext());
if (optimization_guide::features::IsOptimizationHintsEnabled()) {
OptimizationGuideWebContentsObserver::CreateForWebContents(web_contents);
diff --git a/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.cc b/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.cc
--- a/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.cc
+++ b/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.cc
@@ -12,9 +12,11 @@ AutofillMlInternalsPageHandlerImpl::AutofillMlInternalsPageHandlerImpl(
mojo::PendingReceiver<autofill_ml_internals::mojom::PageHandler> receiver,
autofill::MlLogRouter* log_router)
: receiver_(this, std::move(receiver)) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (log_router) {
log_router_observation_.Observe(log_router);
}
+#endif
}
void AutofillMlInternalsPageHandlerImpl::SetPage(
diff --git a/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.h b/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.h
--- a/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.h
+++ b/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_page_handler.h
@@ -8,6 +8,7 @@
#include "base/scoped_observation.h"
#include "components/autofill/core/browser/ml_model/logging/autofill_ml_internals.mojom.h"
#include "components/autofill/core/browser/ml_model/logging/ml_log_router.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -35,8 +36,10 @@ class AutofillMlInternalsPageHandlerImpl
private:
mojo::Receiver<autofill_ml_internals::mojom::PageHandler> receiver_;
mojo::Remote<autofill_ml_internals::mojom::Page> page_;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
base::ScopedObservation<autofill::MlLogRouter, autofill::MlLogReceiver>
log_router_observation_{this};
+#endif
};
#endif // CHROME_BROWSER_UI_WEBUI_AUTOFILL_ML_INTERNALS_AUTOFILL_ML_INTERNALS_PAGE_HANDLER_H_
diff --git a/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_ui.cc b/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_ui.cc
--- a/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_ui.cc
+++ b/chrome/browser/ui/webui/autofill_ml_internals/autofill_ml_internals_ui.cc
@@ -11,6 +11,7 @@
#include "chrome/grit/autofill_ml_internals_resources.h"
#include "chrome/grit/autofill_ml_internals_resources_map.h"
#include "components/autofill/core/browser/ml_model/logging/autofill_ml_internals.mojom.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "ui/webui/webui_util.h"
@@ -29,9 +30,11 @@ AutofillMlInternalsUI::AutofillMlInternalsUI(content::WebUI* web_ui)
void AutofillMlInternalsUI::BindInterface(
mojo::PendingReceiver<autofill_ml_internals::mojom::PageHandler> receiver) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
page_handler_ = std::make_unique<AutofillMlInternalsPageHandlerImpl>(
std::move(receiver), autofill::MlLogRouterFactory::GetForProfile(
Profile::FromWebUI(web_ui())));
+#endif
}
WEB_UI_CONTROLLER_TYPE_IMPL(AutofillMlInternalsUI)
diff --git a/chrome/renderer/accessibility/read_anything/read_aloud_app_model.cc b/chrome/renderer/accessibility/read_anything/read_aloud_app_model.cc
--- a/chrome/renderer/accessibility/read_anything/read_aloud_app_model.cc
+++ b/chrome/renderer/accessibility/read_anything/read_aloud_app_model.cc
@@ -17,7 +17,9 @@
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "base/values.h"
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h"
+#endif
#include "chrome/renderer/accessibility/phrase_segmentation/dependency_tree.h"
#include "chrome/renderer/accessibility/phrase_segmentation/phrase_segmenter.h"
#include "chrome/renderer/accessibility/phrase_segmentation/token_boundaries.h"
@@ -27,6 +29,7 @@
namespace {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// Returns the dependency parser model for this renderer process.
DependencyParserModel& GetDependencyParserModel_() {
static base::NoDestructor<DependencyParserModel> instance;
@@ -39,6 +42,7 @@ std::vector<size_t> GetDependencyHeads(base::span<const std::string> input) {
? dependency_parser_model.GetDependencyHeads(input)
: std::vector<size_t>();
}
+#endif
} // namespace
@@ -163,10 +167,13 @@ void ReadAloudAppModel::PreprocessTextForSpeech(
}
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
DependencyParserModel& ReadAloudAppModel::GetDependencyParserModel() {
return GetDependencyParserModel_();
}
+#endif
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void ReadAloudAppModel::CalculatePhrases(
a11y::ReadAloudCurrentGranularity& granularity) {
if (!features::IsReadAnythingReadAloudPhraseHighlightingEnabled()) {
@@ -223,19 +230,23 @@ void ReadAloudAppModel::CalculatePhrases(
base::BindOnce(&ReadAloudAppModel::UpdatePhraseBoundaries,
weak_ptr_factory_.GetWeakPtr(), phrase_tokens));
}
+#endif
-static const Strategy kPhraseStrategy = Strategy::kWords;
-static const int kPhraseStrategyParameter = 5;
+[[maybe_unused]] static const Strategy kPhraseStrategy = Strategy::kWords;
+[[maybe_unused]] static const int kPhraseStrategyParameter = 5;
void ReadAloudAppModel::StartPhraseCalculation() {
if (processed_granularities_on_current_page_.size() > 0) {
current_phrase_calculation_index_ = 0;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
CalculatePhrases(processed_granularities_on_current_page_[0]);
+#endif
}
}
void ReadAloudAppModel::UpdatePhraseBoundaries(std::vector<std::string> tokens,
std::vector<size_t> heads) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// Reset the phrase calculation flag, so that the next phrase calculation can
// be scheduled, if needed.
is_calculating_phrases = false;
@@ -297,6 +308,7 @@ void ReadAloudAppModel::UpdatePhraseBoundaries(std::vector<std::string> tokens,
current_phrase_calculation_index_ = -1;
LOG(WARNING) << "All phrases calculated!";
}
+#endif
}
// TODO(crbug.com/40927698): Update to use AXRange to better handle multiple
diff --git a/chrome/renderer/accessibility/read_anything/read_aloud_app_model.h b/chrome/renderer/accessibility/read_anything/read_aloud_app_model.h
--- a/chrome/renderer/accessibility/read_anything/read_aloud_app_model.h
+++ b/chrome/renderer/accessibility/read_anything/read_aloud_app_model.h
@@ -8,7 +8,10 @@
#include "base/metrics/single_sample_metrics.h"
#include "base/values.h"
#include "chrome/common/read_anything/read_anything.mojom.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h"
+#endif
#include "chrome/renderer/accessibility/read_anything/read_aloud_traversal_utils.h"
#include "ui/accessibility/ax_node_position.h"
@@ -119,8 +122,10 @@ class ReadAloudAppModel {
bool is_docs,
const std::set<ui::AXNodeID>* current_nodes);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// Get the dependency parsing model for this renderer process.
DependencyParserModel& GetDependencyParserModel();
+#endif
// Increments the processed_granularity_index_, updating ReadAloud's state of
// the current granularity to refer to the next granularity. The current
@@ -293,9 +298,11 @@ class ReadAloudAppModel {
// still needs to be read.
bool NoValidTextRemainingInCurrentNode(bool is_pdf, bool is_docs) const;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// Asynchronously segment the given granularity into phrases. Once the phrases
// are calculated, `UpdatePhraseBoundaries` will be called.
void CalculatePhrases(a11y::ReadAloudCurrentGranularity& granularity);
+#endif
// Once the phrase segmentation has completed for a given sentence, update the
// granularity with the phrase boundaries, and calculate phrases for the next
@@ -369,7 +376,7 @@ class ReadAloudAppModel {
// Whether a phrase calculation for a sentence is currently underway. (We
// do not initiate a second calculation before the first has completed.)
- bool is_calculating_phrases = false;
+ [[maybe_unused]] bool is_calculating_phrases = false;
// Which sentence (index into `processed_granularities_on_current_page`) is
// currently being processed for phrases. -1 if none.
diff --git a/chrome/renderer/accessibility/read_anything/read_anything_app_controller.cc b/chrome/renderer/accessibility/read_anything/read_anything_app_controller.cc
--- a/chrome/renderer/accessibility/read_anything/read_anything_app_controller.cc
+++ b/chrome/renderer/accessibility/read_anything/read_anything_app_controller.cc
@@ -26,7 +26,9 @@
#include "build/build_config.h"
#include "chrome/common/read_anything/read_anything_util.h"
#include "chrome/renderer/accessibility/ax_tree_distiller.h"
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "chrome/renderer/accessibility/phrase_segmentation/dependency_parser_model.h"
+#endif
#include "chrome/renderer/accessibility/read_anything/read_aloud_traversal_utils.h"
#include "chrome/renderer/accessibility/read_anything/read_anything_app_model.h"
#include "chrome/renderer/accessibility/read_anything/read_anything_node_utils.h"
@@ -1810,6 +1812,7 @@ void ReadAnythingAppController::OnConnected() {
render_frame()->GetBrowserInterfaceBroker().GetInterface(
std::move(page_handler_factory_receiver));
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// Get the dependency parser model used by phrase-based highlighting.
if (read_aloud_model_.GetDependencyParserModel().IsAvailable()) {
return;
@@ -1818,6 +1821,7 @@ void ReadAnythingAppController::OnConnected() {
page_handler_->GetDependencyParserModel(
base::BindOnce(&ReadAnythingAppController::UpdateDependencyParserModel,
weak_ptr_factory_.GetWeakPtr()));
+#endif
}
void ReadAnythingAppController::OnCopy() const {
@@ -2062,8 +2066,10 @@ std::u16string ReadAnythingAppController::GetCurrentTextContent() {
}
void ReadAnythingAppController::PreprocessTextForSpeech() {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
read_aloud_model_.PreprocessTextForSpeech(model_.is_pdf(), model_.IsDocs(),
model_.GetCurrentlyVisibleNodes());
+#endif
}
void ReadAnythingAppController::MovePositionToNextGranularity() {
@@ -2320,14 +2326,18 @@ bool ReadAnythingAppController::IsDocsLoadMoreButtonVisible() const {
void ReadAnythingAppController::UpdateDependencyParserModel(
base::File model_file) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
read_aloud_model_.GetDependencyParserModel().UpdateWithFile(
std::move(model_file));
+#endif
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
DependencyParserModel&
ReadAnythingAppController::GetDependencyParserModelForTesting() {
return read_aloud_model_.GetDependencyParserModel();
}
+#endif
void ReadAnythingAppController::OnTreeAdded(ui::AXTree* tree) {
auto observation =
diff --git a/chrome/renderer/accessibility/read_anything/read_anything_app_controller.h b/chrome/renderer/accessibility/read_anything/read_anything_app_controller.h
--- a/chrome/renderer/accessibility/read_anything/read_anything_app_controller.h
+++ b/chrome/renderer/accessibility/read_anything/read_anything_app_controller.h
@@ -47,7 +47,9 @@ class MojoUkmRecorder;
} // namespace ukm
class AXTreeDistiller;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
class DependencyParserModel;
+#endif
class ReadAnythingAppControllerTest;
class ReadAnythingAppControllerScreen2xDataCollectionModeTest;
@@ -313,7 +315,9 @@ class ReadAnythingAppController
// available.
void UpdateDependencyParserModel(base::File model_file);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
DependencyParserModel& GetDependencyParserModelForTesting();
+#endif
// Called when distillation has completed.
void OnAXTreeDistilled(const ui::AXTreeID& tree_id,
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -5812,8 +5812,6 @@ if (!is_android) {
"//chrome/browser/ui/exclusive_access:test_support",
"//chrome/browser/ui/hats",
"//components/safe_browsing/content/browser:safe_browsing_blocking_page",
- "//components/safe_browsing/content/browser/notification_content_detection",
- "//components/safe_browsing/content/browser/notification_content_detection:notifications_global_cache_list",
"//components/safe_browsing/content/common:file_type_policies_test_support",
"//components/safe_browsing/core/browser:safe_browsing_metrics_collector",
"//components/safe_browsing/core/browser/hashprefix_realtime:hash_realtime_service",
diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn
--- a/chrome/utility/BUILD.gn
+++ b/chrome/utility/BUILD.gn
@@ -64,7 +64,7 @@ static_library("utility") {
"//printing/buildflags",
"//services/data_decoder:lib",
"//services/network:network_service",
- "//services/passage_embeddings",
+ # "//services/passage_embeddings",
"//services/passage_embeddings/public/mojom",
"//services/screen_ai/buildflags",
"//services/service_manager/public/cpp",
diff --git a/chrome/utility/services.cc b/chrome/utility/services.cc
--- a/chrome/utility/services.cc
+++ b/chrome/utility/services.cc
@@ -245,13 +245,6 @@ auto RunMirroringService(
#endif // !BUILDFLAG(IS_ANDROID)
-auto RunPassageEmbeddingsService(
- mojo::PendingReceiver<passage_embeddings::mojom::PassageEmbeddingsService>
- receiver) {
- return std::make_unique<passage_embeddings::PassageEmbeddingsService>(
- std::move(receiver));
-}
-
#if BUILDFLAG(ENABLE_BROWSER_SPEECH_SERVICE)
auto RunSpeechRecognitionService(
mojo::PendingReceiver<media::mojom::SpeechRecognitionService> receiver) {
@@ -440,7 +433,6 @@ void RegisterMainThreadServices(mojo::ServiceFactory& services) {
services.Add(RunWebAppOriginAssociationParser);
services.Add(RunCSVPasswordParser);
services.Add(ContentBookmarkParser);
- services.Add(RunPassageEmbeddingsService);
#if !BUILDFLAG(IS_ANDROID)
services.Add(RunProfileImporter);
diff --git a/components/BUILD.gn b/components/BUILD.gn
--- a/components/BUILD.gn
+++ b/components/BUILD.gn
@@ -629,7 +629,7 @@ test("components_unittests") {
"//components/media_router/common/providers/cast/channel:unit_tests",
"//components/one_time_tokens/core/browser:unit_tests",
"//components/page_info:unit_tests",
- "//components/permissions/prediction_service:unit_tests",
+ # "//components/permissions/prediction_service:unit_tests",
"//components/privacy_sandbox/privacy_sandbox_attestations:unit_tests",
"//components/safety_check:unit_tests",
"//components/security_interstitials/content:unit_tests",
diff --git a/components/autofill/core/browser/foundations/autofill_manager.cc b/components/autofill/core/browser/foundations/autofill_manager.cc
--- a/components/autofill/core/browser/foundations/autofill_manager.cc
+++ b/components/autofill/core/browser/foundations/autofill_manager.cc
@@ -135,8 +135,10 @@ struct AutofillManager::AsyncContext {
std::vector<FormData> forms;
std::vector<RegexPredictions> regex_predictions;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
std::vector<ModelPredictions> autofill_predictions;
std::vector<ModelPredictions> password_manager_predictions;
+#endif
GeoIpCountryCode country_code;
LanguageCode current_page_language;
std::unique_ptr<BufferingLogManager> log_manager;
@@ -894,12 +896,14 @@ void AutofillManager::UpdateFormCache(
auto apply_predictions = [](FormStructure& form_structure,
const AsyncContext& context, size_t i) {
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (!context.autofill_predictions.empty()) {
context.autofill_predictions[i].ApplyTo(form_structure.fields());
}
if (!context.password_manager_predictions.empty()) {
context.password_manager_predictions[i].ApplyTo(form_structure.fields());
}
+#endif
if (!context.regex_predictions.empty()) {
context.regex_predictions[i].ApplyTo(form_structure.fields());
}
@@ -990,6 +994,7 @@ void AutofillManager::LogCurrentFieldTypes(
}
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void AutofillManager::SubscribeToMlModelChanges(
FieldClassificationModelHandler& handler) {
switch (handler.optimization_target()) {
@@ -1013,5 +1018,6 @@ void AutofillManager::SubscribeToMlModelChanges(
NOTREACHED();
}
}
+#endif
} // namespace autofill
diff --git a/components/autofill/core/browser/foundations/autofill_manager.h b/components/autofill/core/browser/foundations/autofill_manager.h
--- a/components/autofill/core/browser/foundations/autofill_manager.h
+++ b/components/autofill/core/browser/foundations/autofill_manager.h
@@ -38,6 +38,7 @@
#include "components/autofill/core/common/mojom/autofill_types.mojom.h"
#include "components/autofill/core/common/signatures.h"
#include "components/autofill/core/common/unique_ids.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "components/translate/core/browser/translate_driver.h"
namespace autofill {
@@ -374,10 +375,12 @@ class AutofillManager
// Reparses all known forms.
void ReparseKnownForms();
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
// After subscribing, FieldClassificationModelHandler::OnModelUpdated() will
// trigger ReparseKnownForms(). There may be a handler for Autofill and/or
// Password Manager.
void SubscribeToMlModelChanges(FieldClassificationModelHandler& handler);
+#endif
protected:
explicit AutofillManager(AutofillDriver* driver);
diff --git a/components/autofill/core/browser/integrators/optimization_guide/autofill_optimization_guide_decider.cc b/components/autofill/core/browser/integrators/optimization_guide/autofill_optimization_guide_decider.cc
--- a/components/autofill/core/browser/integrators/optimization_guide/autofill_optimization_guide_decider.cc
+++ b/components/autofill/core/browser/integrators/optimization_guide/autofill_optimization_guide_decider.cc
@@ -273,6 +273,7 @@ void AutofillOptimizationGuideDecider::OnPaymentsDataLoaded(
// If we do not have any optimization types to register, do not do anything.
if (!optimization_types.empty()) {
+ if (decider_)
decider_->RegisterOptimizationTypes(
std::vector<optimization_guide::proto::OptimizationType>(
std::move(optimization_types).extract()));
@@ -380,7 +381,7 @@ bool AutofillOptimizationGuideDecider::ShouldBlockSingleFieldSuggestions(
const AutofillField* field) const {
// If the field's storable type is `IBAN_VALUE`, check whether IBAN
// suggestions should be blocked based on `url`.
- if (field->Type().GetTypes().contains(IBAN_VALUE)) {
+ if (decider_ && field->Type().GetTypes().contains(IBAN_VALUE)) {
optimization_guide::OptimizationGuideDecision decision =
decider_->CanApplyOptimization(
url, optimization_guide::proto::IBAN_AUTOFILL_BLOCKED,
@@ -406,7 +407,7 @@ bool AutofillOptimizationGuideDecider::ShouldBlockFormFieldSuggestion(
const CreditCard& card) const {
if (auto optimization_type =
GetVcnMerchantOptOutOptimizationTypeForCard(card);
- optimization_type != optimization_guide::proto::TYPE_UNSPECIFIED) {
+ decider_ && optimization_type != optimization_guide::proto::TYPE_UNSPECIFIED) {
optimization_guide::OptimizationGuideDecision decision =
decider_->CanApplyOptimization(url, optimization_type,
/*optimization_metadata=*/nullptr);
diff --git a/components/autofill/core/browser/ml_model/field_classification_model_handler.cc b/components/autofill/core/browser/ml_model/field_classification_model_handler.cc
--- a/components/autofill/core/browser/ml_model/field_classification_model_handler.cc
+++ b/components/autofill/core/browser/ml_model/field_classification_model_handler.cc
@@ -101,8 +101,7 @@ bool ParsingSupportsMultipleFieldsOfType(FieldType type) {
FieldClassificationModelHandler::FieldClassificationModelHandler(
optimization_guide::OptimizationGuideModelProvider* model_provider,
- optimization_guide::proto::OptimizationTarget optimization_target,
- MlLogRouter* log_router)
+ optimization_guide::proto::OptimizationTarget optimization_target)
: optimization_guide::ModelHandler<
FieldClassificationModelEncoder::ModelOutput,
const FieldClassificationModelEncoder::ModelInput&>(
@@ -114,8 +113,7 @@ FieldClassificationModelHandler::FieldClassificationModelHandler(
optimization_target,
CreateModelMetadata()),
optimization_target_(optimization_target),
- predictions_cache_(kMaxPredictionsToCache),
- log_router_(log_router) {
+ predictions_cache_(kMaxPredictionsToCache) {
// Store the model in memory as soon as it is available and keep it loaded for
// the whole browser session since we query predictions very regularly.
// TODO(crbug.com/40276177): Maybe change both back to default behavior if we
@@ -164,6 +162,7 @@ void FieldClassificationModelHandler::ApplySmallFormRules(
}
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
autofill_ml_internals::mojom::MlPredictionLogPtr
FieldClassificationModelHandler::CreateMlPredictionLog(
const FormData& form) const {
@@ -236,6 +235,7 @@ FieldClassificationModelHandler::CreateMlPredictionLog(
prediction_log->start_time = base::Time::Now();
return prediction_log;
}
+#endif
void PopulateMlPredictionLogAfterInference(
autofill_ml_internals::mojom::MlPredictionLog& prediction_log,
@@ -264,9 +264,11 @@ void FieldClassificationModelHandler::GetModelPredictionsForForm(
std::optional<autofill_ml_internals::mojom::MlPredictionLogPtr>
prediction_log = std::nullopt;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (log_router_ && log_router_->HasReceivers()) {
prediction_log = CreateMlPredictionLog(form);
}
+#endif
FieldClassificationModelEncoder::ModelInput encoded_input =
state_->encoder.EncodeForm(form);
@@ -331,11 +333,13 @@ void FieldClassificationModelHandler::GetModelPredictionsForForm(
predicted_types);
}
}
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (output && prediction_log && self->log_router_) {
PopulateMlPredictionLogAfterInference(*prediction_log.value(),
output.value());
self->log_router_->ProcessLog(std::move(*prediction_log));
}
+#endif
std::move(callback).Run(std::move(predictions));
},
weak_ptr_factory_.GetWeakPtr(), std::move(prediction_log),
diff --git a/components/autofill/core/browser/ml_model/field_classification_model_handler.h b/components/autofill/core/browser/ml_model/field_classification_model_handler.h
--- a/components/autofill/core/browser/ml_model/field_classification_model_handler.h
+++ b/components/autofill/core/browser/ml_model/field_classification_model_handler.h
@@ -17,8 +17,11 @@
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/form_structure.h"
#include "components/autofill/core/browser/ml_model/field_classification_model_encoder.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "components/autofill/core/browser/ml_model/logging/autofill_ml_internals.mojom.h"
#include "components/autofill/core/browser/ml_model/logging/ml_log_router.h"
+#endif
#include "components/autofill/core/browser/ml_model/model_predictions.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/optimization_guide/core/delivery/optimization_guide_model_provider.h"
@@ -50,8 +53,7 @@ class FieldClassificationModelHandler
FieldClassificationModelHandler(
optimization_guide::OptimizationGuideModelProvider* model_provider,
- optimization_guide::proto::OptimizationTarget optimization_target,
- autofill::MlLogRouter* log_router = nullptr);
+ optimization_guide::proto::OptimizationTarget optimization_target);
~FieldClassificationModelHandler() override;
// This function asynchronously queries predictions for the `form_structure`
@@ -136,8 +138,10 @@ class FieldClassificationModelHandler
ModelInputHash CalculateModelInputHash(
const FieldClassificationModelEncoder::ModelInput& input);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
autofill_ml_internals::mojom::MlPredictionLogPtr CreateMlPredictionLog(
const FormData& form_structure) const;
+#endif
// Converts a `TokenId` to the string representation.
std::string TokenIdToString(
@@ -163,7 +167,9 @@ class FieldClassificationModelHandler
ModelChangeCallbackList model_change_callback_list_;
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
raw_ptr<autofill::MlLogRouter> log_router_ = nullptr;
+#endif
base::WeakPtrFactory<FieldClassificationModelHandler> weak_ptr_factory_{this};
};
diff --git a/components/omnibox/browser/aim_eligibility_service_features.cc b/components/omnibox/browser/aim_eligibility_service_features.cc
--- a/components/omnibox/browser/aim_eligibility_service_features.cc
+++ b/components/omnibox/browser/aim_eligibility_service_features.cc
@@ -9,6 +9,7 @@
namespace omnibox {
BASE_FEATURE(kAimEnabled, base::FEATURE_ENABLED_BY_DEFAULT);
+SET_CROMITE_FEATURE_DISABLED(kAimEnabled); // Disable AI Mode starter pack
BASE_FEATURE(kAimServerEligibilityEnabled, base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc
--- a/components/omnibox/browser/autocomplete_controller.cc
+++ b/components/omnibox/browser/autocomplete_controller.cc
@@ -53,7 +53,9 @@
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/browser/autocomplete_provider.h"
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "components/omnibox/browser/autocomplete_provider_client.h"
+#endif
#include "components/omnibox/browser/autocomplete_scoring_signals_annotator.h"
#include "components/omnibox/browser/bookmark_provider.h"
#include "components/omnibox/browser/bookmark_scoring_signals_annotator.h"
@@ -128,6 +130,7 @@ using ProviderType = AutocompleteProvider::Type;
constexpr bool is_android = !!BUILDFLAG(IS_ANDROID);
+#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
void RecordMlScoreCoverage(size_t matches_with_non_null_scores,
size_t total_scored_matches) {
int percent_score_coverage =
@@ -236,6 +239,7 @@ void RecordTotalMatchesScored(size_t num_scored) {
base::UmaHistogramCounts1000("Omnibox.URLScoringModelExecuted.Matches",
num_scored);
}
+#endif
// Appends available autocompletion of the given type, subtype, and number to
// the existing available autocompletions string, encoding according to the
diff --git a/components/omnibox/browser/base_search_provider.cc b/components/omnibox/browser/base_search_provider.cc
--- a/components/omnibox/browser/base_search_provider.cc
+++ b/components/omnibox/browser/base_search_provider.cc
@@ -102,14 +102,14 @@ BaseSearchProvider::BaseSearchProvider(AutocompleteProvider::Type type,
bool BaseSearchProvider::ShouldPrefetch(const AutocompleteMatch& match) {
// TODO (manukh): `GetAdditionalInfoForDebugging()` shouldn't be used for
// non-debugging purposes.
- return match.GetAdditionalInfoForDebugging(kShouldPrefetchKey) == kTrue;
+ return false;
}
// static
bool BaseSearchProvider::ShouldPrerender(const AutocompleteMatch& match) {
// TODO (manukh): `GetAdditionalInfoForDebugging()` shouldn't be used for
// non-debugging purposes.
- return match.GetAdditionalInfoForDebugging(kShouldPrerenderKey) == kTrue;
+ return false;
}
// static
diff --git a/components/optimization_guide/core/delivery/prediction_model_download_manager.cc b/components/optimization_guide/core/delivery/prediction_model_download_manager.cc
--- a/components/optimization_guide/core/delivery/prediction_model_download_manager.cc
+++ b/components/optimization_guide/core/delivery/prediction_model_download_manager.cc
@@ -53,7 +53,7 @@ const char kDisableModelDownloadsForBenchmarking[] =
// we require models to come from.
constexpr std::array<uint8_t, crypto::hash::kSha256Size> kPublisherKeyHash = {
0x66, 0xa1, 0xd9, 0x3e, 0x4e, 0x5a, 0x66, 0x8a, 0x0f, 0xd3, 0xfa,
- 0xa3, 0x70, 0x71, 0x42, 0x16, 0x0d, 0x2d, 0x68, 0xb0, 0x53, 0x02,
+ 0x01, 0x02, 0x03, 0x04, 0x16, 0x0d, 0x2d, 0x68, 0xb0, 0x53, 0x02,
0x5c, 0x7f, 0xd0, 0x0c, 0xa1, 0x6e, 0xef, 0xdd, 0x63, 0x7a};
const net::NetworkTrafficAnnotationTag
kOptimizationGuidePredictionModelsTrafficAnnotation =
@@ -123,7 +123,7 @@ PredictionModelDownloadManager::PredictionModelDownloadManager(
unzip::UnzipperFactory unzipper_factory,
scoped_refptr<base::SequencedTaskRunner> background_task_runner)
: download_service_tracker_(download_service_tracker),
- is_available_for_downloads_(true),
+ is_available_for_downloads_(false),
api_key_(features::GetOptimizationGuideServiceAPIKey()),
get_base_model_dir_for_download_callback_(
get_base_model_dir_for_download_callback),
@@ -137,6 +137,7 @@ void PredictionModelDownloadManager::StartDownload(
const GURL& download_url,
proto::OptimizationTarget optimization_target,
const std::optional<download::SchedulingParams>& scheduling_params) {
+ if ((true)) return;
download::DownloadParams download_params;
download_params.client =
download::DownloadClient::OPTIMIZATION_GUIDE_PREDICTION_MODELS;
@@ -299,6 +300,7 @@ bool PredictionModelDownloadManager::VerifyDownload(
const base::FilePath& download_file_path,
const base::FilePath& base_model_dir,
bool delete_file_on_error) {
+ if ((true)) return false;
if (!switches::ShouldSkipModelDownloadVerificationForTesting()) {
// Verify that the |download_file_path| contains a valid CRX file.
std::string public_key;
diff --git a/components/optimization_guide/core/delivery/prediction_model_fetcher_impl.cc b/components/optimization_guide/core/delivery/prediction_model_fetcher_impl.cc
--- a/components/optimization_guide/core/delivery/prediction_model_fetcher_impl.cc
+++ b/components/optimization_guide/core/delivery/prediction_model_fetcher_impl.cc
@@ -52,6 +52,7 @@ bool PredictionModelFetcherImpl::FetchOptimizationGuideServiceModels(
proto::RequestContext request_context,
const std::string& locale,
ModelsFetchedCallback models_fetched_callback) {
+ if ((true)) return false;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
TRACE_EVENT(
diff --git a/components/optimization_guide/core/hints/hints_fetcher.cc b/components/optimization_guide/core/hints/hints_fetcher.cc
--- a/components/optimization_guide/core/hints/hints_fetcher.cc
+++ b/components/optimization_guide/core/hints/hints_fetcher.cc
@@ -204,6 +204,7 @@ bool HintsFetcher::FetchOptimizationGuideServiceHints(
bool skip_cache,
HintsFetchedCallback hints_fetched_callback,
std::optional<proto::RequestContextMetadata> request_context_metadata) {
+ if ((true)) return false;
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK_GT(optimization_types.size(), 0u);
request_context_ = request_context;
diff --git a/components/optimization_guide/core/hints/hints_manager.cc b/components/optimization_guide/core/hints/hints_manager.cc
--- a/components/optimization_guide/core/hints/hints_manager.cc
+++ b/components/optimization_guide/core/hints/hints_manager.cc
@@ -457,6 +457,7 @@ void HintsManager::Shutdown() {
OptimizationGuideDecision
HintsManager::GetOptimizationGuideDecisionFromOptimizationTypeDecision(
OptimizationTypeDecision optimization_type_decision) {
+ if ((true)) return OptimizationGuideDecision::kFalse;
switch (optimization_type_decision) {
case OptimizationTypeDecision::kAllowedByOptimizationFilter:
case OptimizationTypeDecision::kAllowedByHint:
@@ -2057,4 +2058,5 @@ void HintsManager::RemoveFetchedEntriesByHintKeys(
hint_cache_->RemoveHintsForHosts(std::move(on_success), hint_keys);
}
+SET_CROMITE_FEATURE_DISABLED(kHintsBatchUpdateForActiveTabsAndTopHosts);
} // namespace optimization_guide
diff --git a/components/optimization_guide/core/optimization_guide_features.cc b/components/optimization_guide/core/optimization_guide_features.cc
--- a/components/optimization_guide/core/optimization_guide_features.cc
+++ b/components/optimization_guide/core/optimization_guide_features.cc
@@ -41,11 +41,7 @@ namespace features {
namespace {
constexpr auto enabled_by_default_mobile_only =
-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
- base::FEATURE_ENABLED_BY_DEFAULT;
-#else
base::FEATURE_DISABLED_BY_DEFAULT;
-#endif
} // namespace
@@ -254,8 +250,7 @@ size_t MaxHostKeyedHintCacheSize() {
}
bool ShouldPersistHintsToDisk() {
- return GetFieldTrialParamByFeatureAsBool(kOptimizationHints,
- "persist_hints_to_disk", true);
+ return false;
}
RequestContextSet GetAllowedContextsForPersonalizedMetadata() {
@@ -603,5 +598,9 @@ std::optional<base::TimeDelta> GetMainFrameGetAIPageContentTimeout() {
return kGetAIPageContentMainFrameTimeoutParam.Get();
}
+SET_CROMITE_FEATURE_DISABLED(kOptimizationHints);
+SET_CROMITE_FEATURE_DISABLED(kOptimizationTargetPrediction);
+SET_CROMITE_FEATURE_DISABLED(kPreventLongRunningPredictionModels);
+SET_CROMITE_FEATURE_DISABLED(kOptimizationGuideFetchingForSRP);
} // namespace features
} // namespace optimization_guide
diff --git a/components/optimization_guide/features.gni b/components/optimization_guide/features.gni
--- a/components/optimization_guide/features.gni
+++ b/components/optimization_guide/features.gni
@@ -15,8 +15,7 @@ declare_args() {
# This enables build with TFLite library.
# TODO(b/269198471): Make sure the internal archive files for opt guide get
# updated when win arm64 gets added as a supported platform for TFLite.
- build_with_tflite_lib = is_android || is_win || is_linux || is_mac ||
- is_chromeos || is_fuchsia || is_ios
+ build_with_tflite_lib = false
}
if (is_ios) {
diff --git a/components/page_content_annotations/core/page_content_annotations_features.cc b/components/page_content_annotations/core/page_content_annotations_features.cc
--- a/components/page_content_annotations/core/page_content_annotations_features.cc
+++ b/components/page_content_annotations/core/page_content_annotations_features.cc
@@ -69,6 +69,7 @@ const base::FeatureParam<std::string> kPageContentExtractionTriggeringMode{
bool IsSupportedLocale(const std::string& locale,
const std::string& supported_locales) {
+ if ((true)) return false;
if (supported_locales == "*") {
return true;
}
@@ -88,6 +89,7 @@ bool IsSupportedLocale(const std::string& locale,
bool IsSupportedCountry(const std::string& country_code,
const std::string& supported_countries) {
+ if ((true)) return false;
if (supported_countries == "*") {
return true;
}
@@ -295,6 +297,7 @@ bool IsSupportedLocaleForFeature(
const std::string& locale,
const base::Feature& feature,
const std::string& default_value = "de,en,es,fr,it,nl,pt,tr") {
+ if ((true)) return false;
if (!base::FeatureList::IsEnabled(feature)) {
return false;
}
@@ -312,6 +315,7 @@ bool IsSupportedLocaleForFeature(
bool IsSupportedCountryForFeature(const std::string& country_code,
const base::Feature& feature,
const std::string& default_value) {
+ if ((true)) return false;
if (!base::FeatureList::IsEnabled(feature)) {
return false;
}
@@ -326,4 +330,7 @@ bool IsSupportedCountryForFeature(const std::string& country_code,
return IsSupportedCountry(country_code, value);
}
+SET_CROMITE_FEATURE_DISABLED(kPageContentAnnotations);
+SET_CROMITE_FEATURE_DISABLED(kPageContentAnnotationsValidation);
+SET_CROMITE_FEATURE_DISABLED(kRemotePageMetadata);
} // namespace page_content_annotations::features
diff --git a/components/page_content_annotations/core/page_content_annotations_model_manager.cc b/components/page_content_annotations/core/page_content_annotations_model_manager.cc
--- a/components/page_content_annotations/core/page_content_annotations_model_manager.cc
+++ b/components/page_content_annotations/core/page_content_annotations_model_manager.cc
@@ -44,6 +44,7 @@ PageContentAnnotationsModelManager::~PageContentAnnotationsModelManager() =
void PageContentAnnotationsModelManager::SetUpPageVisibilityModel(
optimization_guide::OptimizationGuideModelProvider*
optimization_guide_model_provider) {
+ if ((true)) return; // was kPageVisibilityBatchAnnotations
if (page_visibility_model_handler_)
return;
diff --git a/components/safe_browsing/content/browser/notification_content_detection/BUILD.gn b/components/safe_browsing/content/browser/notification_content_detection/BUILD.gn
--- a/components/safe_browsing/content/browser/notification_content_detection/BUILD.gn
+++ b/components/safe_browsing/content/browser/notification_content_detection/BUILD.gn
@@ -23,10 +23,6 @@ source_set("notification_content_detection") {
sources = [
"notification_content_detection_constants.cc",
"notification_content_detection_constants.h",
- "notification_content_detection_model.cc",
- "notification_content_detection_model.h",
- "notification_content_detection_service.cc",
- "notification_content_detection_service.h",
]
deps = [
diff --git a/components/viz/service/BUILD.gn b/components/viz/service/BUILD.gn
--- a/components/viz/service/BUILD.gn
+++ b/components/viz/service/BUILD.gn
@@ -315,8 +315,8 @@ viz_component("service") {
"//services/metrics/public/mojom",
"//services/tracing/public/cpp",
"//services/viz/privileged/mojom",
- "//services/webnn:webnn_service",
- "//services/webnn/public/mojom",
+ #"//services/webnn:webnn_service",
+ #"//services/webnn/public/mojom",
"//skia",
"//skia:skcms",
"//third_party/blink/public/common",
diff --git a/components/viz/service/gl/gpu_service_impl.cc b/components/viz/service/gl/gpu_service_impl.cc
--- a/components/viz/service/gl/gpu_service_impl.cc
+++ b/components/viz/service/gl/gpu_service_impl.cc
@@ -649,24 +649,6 @@ void GpuServiceImpl::BindWebNNContextProvider(
std::move(pending_receiver), client_id));
return;
}
-
- if (!webnn_context_provider_) {
- scoped_refptr<gpu::SharedContextState> shared_context_state =
- GetContextState();
- // `shared_context_state` may be nullptr if there is no GPU acceleration.
- // For such case, WebNN CPU backend, e.g. TFLite XNNPACK, is still useful.
-
- // TODO(crbug.com/345352987): manage `WebNNContextProviderImpl` instance per
- // `client_id` in order to support memory metrics.
- webnn_context_provider_ = webnn::WebNNContextProviderImpl::Create(
- std::move(shared_context_state), gpu_feature_info_, gpu_info_,
- shared_image_manager(),
- base::BindOnce(&GpuServiceImpl::LoseAllContexts, weak_ptr_),
- main_runner(), GetGpuScheduler(), client_id, gpu_host_);
- }
-
- webnn_context_provider_->BindWebNNContextProvider(
- std::move(pending_receiver));
}
void GpuServiceImpl::GetVideoMemoryUsageStats(
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -270,9 +270,9 @@ source_set("browser") {
"//services/viz/public/cpp/gpu",
"//services/viz/public/mojom",
"//services/webnn:buildflags",
- "//services/webnn:webnn_service",
- "//services/webnn:webnn_switches",
- "//services/webnn/public/mojom",
+ # "//services/webnn:webnn_service",
+ # "//services/webnn:webnn_switches",
+ # "//services/webnn/public/mojom",
"//skia",
"//skia/public/mojom",
"//sql",
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -1346,9 +1346,9 @@ bool GpuProcessHost::LaunchGpuProcess() {
cmd_line->CopySwitchesFrom(browser_command_line, kSwitchNames);
cmd_line->CopySwitchesFrom(browser_command_line,
switches::kGLSwitchesCopiedFromGpuProcessHost);
- cmd_line->CopySwitchesFrom(
- browser_command_line,
- switches::GetWebNNSwitchesCopiedFromGpuProcessHost());
+ // cmd_line->CopySwitchesFrom(
+ // browser_command_line,
+ // switches::GetWebNNSwitchesCopiedFromGpuProcessHost());
if (browser_command_line.HasSwitch(switches::kDisableFrameRateLimit))
cmd_line->AppendSwitch(switches::kDisableGpuVsync);
diff --git a/content/browser/service_worker/service_worker_main_resource_loader.cc b/content/browser/service_worker/service_worker_main_resource_loader.cc
--- a/content/browser/service_worker/service_worker_main_resource_loader.cc
+++ b/content/browser/service_worker/service_worker_main_resource_loader.cc
@@ -550,6 +550,7 @@ bool ServiceWorkerMainResourceLoader::MaybeStartAutoPreload(
bool ServiceWorkerMainResourceLoader::StartRaceNetworkRequest(
scoped_refptr<ServiceWorkerContextWrapper> context,
scoped_refptr<ServiceWorkerVersion> version) {
+ if ((true)) return false;
// Set fetch_handler_bypass_option to tell the renderer that
// RaceNetworkRequest is enabled.
version->set_fetch_handler_bypass_option(
diff --git a/cromite_flags/chrome/browser/browser_features_cc/Disable-all-predictors-code.inc b/cromite_flags/chrome/browser/browser_features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/chrome/browser/browser_features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1,2 @@
+SET_CROMITE_FEATURE_ENABLED(kBookmarkTriggerForPrerender2KillSwitch);
+SET_CROMITE_FEATURE_DISABLED(kNewTabPageTriggerForPrerender2);
diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Disable-all-predictors-code.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Disable-all-predictors-code.inc
@@ -0,0 +1 @@
+// Empty file
diff --git a/cromite_flags/chrome/common/chrome_features_cc/Disable-all-predictors-code.inc b/cromite_flags/chrome/common/chrome_features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/chrome/common/chrome_features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1 @@
+SET_CROMITE_FEATURE_DISABLED(kPrerenderFallbackToPreconnect);
diff --git a/cromite_flags/components/password_manager/core/browser/features/password_features_cc/Disable-all-predictors-code.inc b/cromite_flags/components/password_manager/core/browser/features/password_features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/components/password_manager/core/browser/features/password_features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1 @@
+SET_CROMITE_FEATURE_DISABLED(kDownloadModelForPasswordChange);
diff --git a/cromite_flags/components/permissions/features_cc/Disable-all-predictors-code.inc b/cromite_flags/components/permissions/features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/components/permissions/features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1,5 @@
+SET_CROMITE_FEATURE_DISABLED(kPermissionPredictionsV2);
+
+#if BUILDFLAG(IS_ANDROID)
+SET_CROMITE_FEATURE_DISABLED(kPermissionDedicatedCpssSettingAndroid);
+#endif
diff --git a/cromite_flags/net/base/features_cc/Disable-all-predictors-code.inc b/cromite_flags/net/base/features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/net/base/features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1 @@
+SET_CROMITE_FEATURE_DISABLED(kHttpCacheNoVarySearch);
diff --git a/cromite_flags/services/network/public/cpp/features_cc/Disable-all-predictors-code.inc b/cromite_flags/services/network/public/cpp/features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/services/network/public/cpp/features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1 @@
+SET_CROMITE_FEATURE_DISABLED(kNetworkContextPrefetch);
diff --git a/cromite_flags/third_party/blink/common/features_cc/Disable-all-predictors-code.inc b/cromite_flags/third_party/blink/common/features_cc/Disable-all-predictors-code.inc
new file mode 100644
--- /dev/null
+++ b/cromite_flags/third_party/blink/common/features_cc/Disable-all-predictors-code.inc
@@ -0,0 +1,2 @@
+SET_CROMITE_FEATURE_DISABLED(kNavigationPredictor);
+SET_CROMITE_FEATURE_DISABLED(kPreloadingHeuristicsMLModel);
diff --git a/media/webrtc/BUILD.gn b/media/webrtc/BUILD.gn
--- a/media/webrtc/BUILD.gn
+++ b/media/webrtc/BUILD.gn
@@ -4,6 +4,7 @@
import("//media/media_options.gni")
import("//third_party/webrtc/webrtc.gni")
+import("//components/optimization_guide/features.gni")
component("webrtc") {
output_name = "media_webrtc"
@@ -31,6 +32,10 @@ component("webrtc") {
"//third_party/webrtc_overrides:webrtc_component",
]
+ if (!build_with_tflite_lib) {
+ deps -= [ "//components/optimization_guide/core/inference:op_resolver" ]
+ }
+
public_deps = [ "//third_party/tflite" ]
}
diff --git a/media/webrtc/helpers.cc b/media/webrtc/helpers.cc
--- a/media/webrtc/helpers.cc
+++ b/media/webrtc/helpers.cc
@@ -14,6 +14,7 @@
#include "build/build_config.h"
#include "build/chromecast_buildflags.h"
#include "components/optimization_guide/core/tflite_op_resolver.h"
+#include "components/optimization_guide/machine_learning_tflite_buildflags.h"
#include "media/base/media_switches.h"
#include "media/webrtc/webrtc_features.h"
#include "third_party/webrtc/api/audio/audio_processing.h"
@@ -161,7 +162,7 @@ CreateWebRtcAudioProcessingModule(
// Fuchsia does not use the optimization guide.
// Avoid linking the op resolver to keep Fuchsia binary size down.
// TODO(crbug.com/450466837): Investigate if this build guard can be avoided.
-#if !BUILDFLAG(IS_FUCHSIA)
+#if !BUILDFLAG(IS_FUCHSIA) && BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (residual_echo_estimator_model) {
optimization_guide::TFLiteOpResolver op_resolver;
echo_estimator = webrtc::CreateNeuralResidualEchoEstimator(
diff --git a/services/on_device_model/ml/BUILD.gn b/services/on_device_model/ml/BUILD.gn
--- a/services/on_device_model/ml/BUILD.gn
+++ b/services/on_device_model/ml/BUILD.gn
@@ -83,7 +83,7 @@ if (use_blink || (is_ios && build_with_internal_optimization_guide)) {
if (use_blink) {
deps += [ "//gpu/config" ]
}
- if (!is_fuchsia && build_with_tflite_lib) {
+ if (build_with_tflite_lib && !is_fuchsia) {
deps += [ "//services/on_device_model/safety:bert_safety_model" ]
}
if (is_win || is_mac || is_linux) {
diff --git a/services/on_device_model/ml/ts_model.cc b/services/on_device_model/ml/ts_model.cc
--- a/services/on_device_model/ml/ts_model.cc
+++ b/services/on_device_model/ml/ts_model.cc
@@ -27,7 +27,7 @@
#include "services/on_device_model/public/mojom/on_device_model_service.mojom.h"
#include "services/on_device_model/safety/safety_util.h"
-#if !BUILDFLAG(IS_FUCHSIA) && BUILDFLAG(BUILD_WITH_TFLITE_LIB)
+#if false && !BUILDFLAG(IS_FUCHSIA) && BUILDFLAG(BUILD_WITH_TFLITE_LIB)
#include "services/on_device_model/safety/bert_safety_model.h"
#endif
@@ -207,7 +207,7 @@ void TsHolder::Reset(mojom::TextSafetyModelParamsPtr params,
mojo::PendingReceiver<mojom::TextSafetyModel> model) {
model_.Clear();
-#if !BUILDFLAG(IS_FUCHSIA) && BUILDFLAG(BUILD_WITH_TFLITE_LIB)
+#if false && !BUILDFLAG(IS_FUCHSIA) && BUILDFLAG(BUILD_WITH_TFLITE_LIB)
if (!params->safety_assets || params->safety_assets->which() ==
mojom::SafetyModelAssets::Tag::kTsAssets) {
auto impl = TsModel::Create(*chrome_ml_, std::move(params));
diff --git a/services/on_device_model/safety/BUILD.gn b/services/on_device_model/safety/BUILD.gn
--- a/services/on_device_model/safety/BUILD.gn
+++ b/services/on_device_model/safety/BUILD.gn
@@ -4,7 +4,7 @@
import("//components/optimization_guide/features.gni")
-if (!is_fuchsia && build_with_tflite_lib) {
+if (build_with_tflite_lib && !is_fuchsia) {
source_set("bert_safety_op_resolver") {
sources = [
"bert_safety_op_resolver.cc",
diff --git a/services/webnn/BUILD.gn b/services/webnn/BUILD.gn
--- a/services/webnn/BUILD.gn
+++ b/services/webnn/BUILD.gn
@@ -169,7 +169,7 @@ component("webnn_service") {
}
}
- if (is_win) {
+ if (is_win && webnn_use_tflite) {
sources += [
"ort/context_impl_ort.cc",
"ort/context_impl_ort.h",
diff --git a/services/webnn/features.gni b/services/webnn/features.gni
--- a/services/webnn/features.gni
+++ b/services/webnn/features.gni
@@ -9,7 +9,7 @@ assert(use_blink)
declare_args() {
# TFLite is used as a fallback option on Apple and Windows.
- webnn_use_tflite = is_android || is_chromeos || is_linux || is_apple || is_win
+ webnn_use_tflite = false #is_android || is_chromeos || is_linux || is_apple || is_win
# Enable the GPU delegate provided by the Optimization Guide library.
webnn_use_chrome_ml_api = enable_ml_internal
diff --git a/services/webnn/webnn_context_provider_impl.cc b/services/webnn/webnn_context_provider_impl.cc
--- a/services/webnn/webnn_context_provider_impl.cc
+++ b/services/webnn/webnn_context_provider_impl.cc
@@ -244,18 +244,7 @@ void WebNNContextProviderImpl::CreateWebNNContext(
}
#if BUILDFLAG(IS_WIN)
- if (ort::ShouldCreateOrtContext(*options)) {
- scoped_trace.AddStep("EnsureWebNNExecutionProvidersReady");
-
- gpu_host_->EnsureWebNNExecutionProvidersReady(base::BindOnce(
- &WebNNContextProviderImpl::DidEnsureWebNNExecutionProvidersReady,
- AsWeakPtr(), std::move(scoped_trace), std::move(options),
- std::move(write_tensor_producer), std::move(write_tensor_consumer),
- std::move(read_tensor_producer), std::move(read_tensor_consumer),
- command_buffer_id, std::move(sequence), std::move(owning_task_runner),
- std::move(receiver), std::move(remote), std::move(callback)));
- return;
- } else if (dml::ShouldCreateDmlContext(*options)) {
+ if (dml::ShouldCreateDmlContext(*options)) {
base::expected<WebNNContextImplPtr, mojom::ErrorPtr>
context_creation_results = dml::CreateContextFromOptions(
std::move(options), std::move(write_tensor_consumer),
diff --git a/third_party/blink/renderer/core/html/parser/html_document_parser.cc b/third_party/blink/renderer/core/html/parser/html_document_parser.cc
--- a/third_party/blink/renderer/core/html/parser/html_document_parser.cc
+++ b/third_party/blink/renderer/core/html/parser/html_document_parser.cc
@@ -1846,6 +1846,7 @@ ALWAYS_INLINE bool HTMLDocumentParser::ShouldCheckTimeBudget(
}
bool HTMLDocumentParser::ShouldSkipPreloadScan() {
+ if ((true)) return true; // see https://wpt.live/html/syntax/speculative-parsing/expect-no-linked-resources/no-speculative-fetch.tentative.optional.html
// Check if Document-Policy has Expect-No-Linked-Resources hint.
auto* document = GetDocument();
if (const auto* context = document->GetExecutionContext()) {
diff --git a/third_party/blink/renderer/core/speculation_rules/document_speculation_rules.cc b/third_party/blink/renderer/core/speculation_rules/document_speculation_rules.cc
--- a/third_party/blink/renderer/core/speculation_rules/document_speculation_rules.cc
+++ b/third_party/blink/renderer/core/speculation_rules/document_speculation_rules.cc
@@ -659,6 +659,7 @@ void DocumentSpeculationRules::UpdateSpeculationCandidates() {
return;
}
+ if ((true)) return;
HeapVector<Member<SpeculationCandidate>> candidates;
auto push_candidates = [&candidates, &document, this](
mojom::blink::SpeculationAction action,
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -3989,7 +3989,7 @@
//
// It also has some feature params defined throughout the codebase.
name: "Prerender2",
- status: "stable",
+ status: "test",
},
{
// Used to allow prerender cross-origin iframes with an opt-in response
--