Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Force to refresh sync cycle(poll/nudge) when transiting from CONFIGURATION to NORMAL mode. (uplift to 1.13.x) #6366

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/config/brave_build.gni
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import("//brave/brave_repack_locales.gni")
import("//brave/build/config/compiler.gni")
import("//brave/build/features.gni")
import("//brave/components/sync/sources.gni")
import("//brave/components/sync/driver/sources.gni")
import("//brave/net/sources.gni")
import("//brave/third_party/blink/renderer/includes.gni")
10 changes: 10 additions & 0 deletions chromium_src/components/sync/engine/sync_manager_factory.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/components/sync/engine_impl/brave_sync_manager_impl.h"

#define SyncManagerImpl BraveSyncManagerImpl
#include "../../../../../components/sync/engine/sync_manager_factory.cc"
#undef SyncManagerImpl
24 changes: 24 additions & 0 deletions components/sync/engine_impl/brave_sync_manager_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/components/sync/engine_impl/brave_sync_manager_impl.h"

namespace syncer {

BraveSyncManagerImpl::BraveSyncManagerImpl(
const std::string& name,
network::NetworkConnectionTracker* network_connection_tracker)
: SyncManagerImpl(name, network_connection_tracker) {}

BraveSyncManagerImpl::~BraveSyncManagerImpl() {}

void BraveSyncManagerImpl::StartSyncingNormally(base::Time last_poll_time) {
SyncManagerImpl::StartSyncingNormally(last_poll_time);
// Remove this hack when we have FCM invalidation integrated.
// We only enable BOOKMARKS by default so only force refresh it
RefreshTypes(ModelTypeSet(BOOKMARKS));
}

} // namespace syncer
30 changes: 30 additions & 0 deletions components/sync/engine_impl/brave_sync_manager_impl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Copyright (c) 2020 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef BRAVE_COMPONENTS_SYNC_ENGINE_IMPL_BRAVE_SYNC_MANAGER_IMPL_H_
#define BRAVE_COMPONENTS_SYNC_ENGINE_IMPL_BRAVE_SYNC_MANAGER_IMPL_H_

#include <string>

#include "components/sync/engine_impl/sync_manager_impl.h"

namespace syncer {

class BraveSyncManagerImpl : public SyncManagerImpl {
public:
BraveSyncManagerImpl(
const std::string& name,
network::NetworkConnectionTracker* network_connection_tracker);
~BraveSyncManagerImpl() override;

void StartSyncingNormally(base::Time last_poll_time) override;

private:
DISALLOW_COPY_AND_ASSIGN(BraveSyncManagerImpl);
};

} // namespace syncer

#endif // BRAVE_COMPONENTS_SYNC_ENGINE_IMPL_BRAVE_SYNC_MANAGER_IMPL_H_
9 changes: 9 additions & 0 deletions components/sync/sources.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2020 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

brave_components_sync_sources = [
"//brave/components/sync/engine_impl/brave_sync_manager_impl.cc",
"//brave/components/sync/engine_impl/brave_sync_manager_impl.h",
]
12 changes: 12 additions & 0 deletions patches/components-sync-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn
index db5a9d0154d0c1e1390e4af6272d7d6cebe24b57..3cde948c91c4aa13297de70dafa86ee33db32906 100644
--- a/components/sync/BUILD.gn
+++ b/components/sync/BUILD.gn
@@ -413,6 +413,7 @@ jumbo_static_library("rest_of_sync") {
"syncable/write_transaction_info.cc",
"syncable/write_transaction_info.h",
]
+ sources += brave_components_sync_sources

configs += [ "//build/config:precompiled_headers" ]