File remove-sync.patch of Package nodejs-electron
Do not build //components/sync with its massive protos.
It's unused in Electron (it's only there to support Google profile login) and dropping it saves about 1~2 MB binary size.
Inspired by:
* https://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit?h=122-based&id=8a9d741f4c4cf8170d5c50a336d51fe5d1b16ce8
* https://code.qt.io/cgit/qt/qtwebengine-chromium.git/commit?h=122-based&id=6a11e9169f5889883bf63a3522d0c3f8f23552b0
--- src/components/search_engines/BUILD.gn.orig
+++ src/components/search_engines/BUILD.gn
@@ -66,7 +66,6 @@ static_library("search_engines") {
"//components/google/core/common",
"//components/keyed_service/core",
"//components/prefs",
- "//components/sync",
"//components/webdata/common",
"//third_party/metrics_proto",
]
--- src/electron/BUILD.gn.orig
+++ src/electron/BUILD.gn
@@ -1204,6 +1204,8 @@ if (is_mac) {
"//electron/buildflags",
"//ui/strings",
]
+
+ assert_no_deps = [ "//components/sync/*" ]
data = []
data_deps = []
--- src/electron/chromium_src/BUILD.gn.orig
+++ src/electron/chromium_src/BUILD.gn
@@ -493,7 +493,6 @@ source_set("chrome_spellchecker") {
"//base:base_static",
"//components/language/core/browser",
"//components/spellcheck:buildflags",
- "//components/sync",
]
public_deps += [ "//chrome/common:constants" ]
--- src/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc.orig
+++ src/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc
@@ -27,10 +27,6 @@
#include "chrome/common/chrome_constants.h"
#include "components/spellcheck/browser/spellcheck_host_metrics.h"
#include "components/spellcheck/common/spellcheck_common.h"
-#include "components/sync/model/sync_change.h"
-#include "components/sync/model/sync_change_processor.h"
-#include "components/sync/protocol/dictionary_specifics.pb.h"
-#include "components/sync/protocol/entity_specifics.pb.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@@ -256,7 +252,6 @@ bool SpellcheckCustomDictionary::AddWord
int result = dictionary_change->Sanitize(GetWords());
Apply(*dictionary_change);
Notify(*dictionary_change);
- Sync(*dictionary_change);
Save(std::move(dictionary_change));
return result == VALID_CHANGE;
}
@@ -268,7 +263,6 @@ bool SpellcheckCustomDictionary::RemoveW
int result = dictionary_change->Sanitize(GetWords());
Apply(*dictionary_change);
Notify(*dictionary_change);
- Sync(*dictionary_change);
Save(std::move(dictionary_change));
return result == VALID_CHANGE;
}
@@ -302,10 +296,12 @@ bool SpellcheckCustomDictionary::IsLoade
return is_loaded_;
}
+#if 0
bool SpellcheckCustomDictionary::IsSyncing() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
return !!sync_processor_.get();
}
+#endif
void SpellcheckCustomDictionary::Load() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -317,6 +313,7 @@ void SpellcheckCustomDictionary::Load()
weak_ptr_factory_.GetWeakPtr()));
}
+#if 0
void SpellcheckCustomDictionary::WaitUntilReadyToSync(base::OnceClosure done) {
DCHECK(!wait_until_ready_to_sync_cb_);
if (is_loaded_)
@@ -414,6 +411,7 @@ SpellcheckCustomDictionary::ProcessSyncC
base::WeakPtr<syncer::SyncableService> SpellcheckCustomDictionary::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
+#endif
SpellcheckCustomDictionary::LoadFileResult::LoadFileResult()
: is_valid_file(false) {}
@@ -460,7 +458,6 @@ void SpellcheckCustomDictionary::OnLoade
dictionary_change.AddWords(result->words);
dictionary_change.Sanitize(GetWords());
Apply(dictionary_change);
- Sync(dictionary_change);
is_loaded_ = true;
if (wait_until_ready_to_sync_cb_)
std::move(wait_until_ready_to_sync_cb_).Run();
@@ -507,6 +504,7 @@ void SpellcheckCustomDictionary::Save(
std::move(dictionary_change), custom_dictionary_path_));
}
+#if 0
std::optional<syncer::ModelError> SpellcheckCustomDictionary::Sync(
const Change& dictionary_change) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -558,6 +556,7 @@ std::optional<syncer::ModelError> Spellc
return std::nullopt;
}
+#endif
void SpellcheckCustomDictionary::Notify(const Change& dictionary_change) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
--- src/chrome/browser/spellchecker/spellcheck_custom_dictionary.h.orig
+++ src/chrome/browser/spellchecker/spellcheck_custom_dictionary.h
@@ -17,9 +17,6 @@
#include "base/observer_list.h"
#include "base/task/sequenced_task_runner.h"
#include "components/spellcheck/browser/spellcheck_dictionary.h"
-#include "components/sync/model/model_error.h"
-#include "components/sync/model/sync_data.h"
-#include "components/sync/model/syncable_service.h"
namespace base {
class Location;
@@ -38,8 +35,7 @@ class SyncChangeProcessor;
// foo
// checksum_v1 = ec3df4034567e59e119fcf87f2d9bad4
//
-class SpellcheckCustomDictionary final : public SpellcheckDictionary,
- public syncer::SyncableService {
+class SpellcheckCustomDictionary final : public SpellcheckDictionary {
public:
// A change to the dictionary.
class Change {
@@ -162,11 +158,11 @@ class SpellcheckCustomDictionary final :
bool IsLoaded();
// Returns true if the dictionary is being synced. Otherwise returns false.
- bool IsSyncing();
// Overridden from SpellcheckDictionary:
void Load() override;
+#if 0
// Overridden from syncer::SyncableService:
void WaitUntilReadyToSync(base::OnceClosure done) override;
std::optional<syncer::ModelError> MergeDataAndStartSyncing(
@@ -179,6 +175,7 @@ class SpellcheckCustomDictionary final :
const base::Location& from_here,
const syncer::SyncChangeList& change_list) override;
base::WeakPtr<SyncableService> AsWeakPtr() override;
+#endif
private:
friend class DictionarySyncIntegrationTestHelper;
@@ -217,7 +214,6 @@ class SpellcheckCustomDictionary final :
// Notifies the sync service of the |dictionary_change|. Syncs up to the
// maximum syncable words on the server. Disables syncing of this dictionary
// if the server contains the maximum number of syncable words.
- std::optional<syncer::ModelError> Sync(const Change& dictionary_change);
// Notifies observers of the dictionary change if the dictionary has been
// changed.
@@ -236,7 +232,6 @@ class SpellcheckCustomDictionary final :
base::ObserverList<Observer>::Unchecked observers_;
// Used to send local changes to the sync infrastructure.
- std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_;
// True if the dictionary has been loaded. Otherwise false.
bool is_loaded_;
--- src/device/fido/BUILD.gn.orig 2024-12-08 18:34:58.231340083 +0100
+++ src/device/fido/BUILD.gn 2024-12-18 12:59:49.294713941 +0100
@@ -163,36 +163,6 @@ component("fido") {
"device_operation.h",
"device_response_converter.cc",
"device_response_converter.h",
- "enclave/constants.cc",
- "enclave/constants.h",
- "enclave/enclave_authenticator.cc",
- "enclave/enclave_authenticator.h",
- "enclave/enclave_discovery.cc",
- "enclave/enclave_discovery.h",
- "enclave/enclave_protocol_utils.cc",
- "enclave/enclave_protocol_utils.h",
- "enclave/enclave_websocket_client.cc",
- "enclave/enclave_websocket_client.h",
- "enclave/metrics.cc",
- "enclave/metrics.h",
- "enclave/transact.cc",
- "enclave/transact.h",
- "enclave/types.cc",
- "enclave/types.h",
- "enclave/verify/amd.cc",
- "enclave/verify/amd.h",
- "enclave/verify/attestation_report.cc",
- "enclave/verify/attestation_report.h",
- "enclave/verify/claim.cc",
- "enclave/verify/claim.h",
- "enclave/verify/endorsement.cc",
- "enclave/verify/endorsement.h",
- "enclave/verify/rekor.cc",
- "enclave/verify/rekor.h",
- "enclave/verify/utils.cc",
- "enclave/verify/utils.h",
- "enclave/verify/verifier.cc",
- "enclave/verify/verifier.h",
"fido_authenticator.cc",
"fido_authenticator.h",
"fido_device.cc",
@@ -257,7 +227,6 @@ component("fido") {
]
deps += [
- "//components/sync/protocol:protocol",
"//device/fido/enclave/verify/proto:proto",
"//services/device/public/cpp/hid",
"//services/device/public/cpp/usb",
--- src/device/fido/fido_discovery_factory.cc.orig 2024-12-08 18:34:58.241340085 +0100
+++ src/device/fido/fido_discovery_factory.cc 2024-12-18 13:01:00.958049095 +0100
@@ -13,7 +13,6 @@
#include "device/fido/aoa/android_accessory_discovery.h"
#include "device/fido/cable/fido_cable_discovery.h"
#include "device/fido/cable/v2_discovery.h"
-#include "device/fido/enclave/enclave_discovery.h"
#include "device/fido/features.h"
#include "device/fido/fido_discovery_base.h"
#include "device/fido/hid/fido_hid_discovery.h"
@@ -124,12 +123,7 @@ std::vector<std::unique_ptr<FidoDiscover
std::optional<std::unique_ptr<FidoDiscoveryBase>>
FidoDiscoveryFactory::MaybeCreateEnclaveDiscovery() {
- if (!base::FeatureList::IsEnabled(kWebAuthnEnclaveAuthenticator) ||
- !enclave_ui_request_stream_ || !network_context_factory_) {
return std::nullopt;
- }
- return std::make_unique<enclave::EnclaveAuthenticatorDiscovery>(
- std::move(enclave_ui_request_stream_), network_context_factory_);
}
bool FidoDiscoveryFactory::IsTestOverride() {
--- src/device/fido/fido_discovery_factory.h.orig
+++ src/device/fido/fido_discovery_factory.h
@@ -15,7 +15,6 @@
#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
-#include "components/sync/protocol/webauthn_credential_specifics.pb.h"
#include "device/fido/cable/cable_discovery_data.h"
#include "device/fido/cable/v2_constants.h"
#include "device/fido/ctap_get_assertion_request.h"
--- src/components/variations/service/BUILD.gn.orig 2024-12-08 18:34:57.401340060 +0100
+++ src/components/variations/service/BUILD.gn 2025-01-01 21:55:42.476247680 +0100
@@ -74,7 +74,6 @@ static_library("service") {
"//components/network_time",
"//components/pref_registry",
"//components/prefs",
- "//components/sync/service",
"//components/variations",
"//components/variations/field_trial_config",
"//components/variations/proto",