Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Unified Diff: components/sync_sessions/sessions_sync_manager.cc

Issue 2750163003: Prevent tabs sync during browser shutdown.
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/sync_sessions/sessions_sync_manager.cc
diff --git a/components/sync_sessions/sessions_sync_manager.cc b/components/sync_sessions/sessions_sync_manager.cc
index d61d75591b9a75f8bf94956cfdbe0bec00c1797b..2c49b4b7dcd85020fb3d7f5f54352b327de39933 100644
--- a/components/sync_sessions/sessions_sync_manager.cc
+++ b/components/sync_sessions/sessions_sync_manager.cc
@@ -128,6 +128,7 @@ SessionsSyncManager::SessionsSyncManager(
sessions_client->GetHistoryService(),
kMaxSyncFavicons),
local_tab_pool_out_of_sync_(true),
+ all_browsers_closing_(false),
sync_prefs_(sync_prefs),
local_device_(local_device),
current_device_type_(sync_pb::SyncEnums_DeviceType_TYPE_OTHER),
@@ -469,6 +470,11 @@ void SessionsSyncManager::OnLocalTabModified(SyncedTabDelegate* modified_tab) {
return;
}
+ if (all_browsers_closing_) {
+ // Do not sync tabs closing during browser shutdown.
+ return;
+ }
+
syncer::SyncChangeList changes;
AssociateTab(modified_tab, &changes);
// Note, we always associate windows because it's possible a tab became
@@ -485,6 +491,14 @@ void SessionsSyncManager::OnFaviconsChanged(const std::set<GURL>& page_urls,
favicon_cache_.OnPageFaviconUpdated(page_url);
}
+void SessionsSyncManager::SetAllBrowsersClosing(bool browsers_closing) {
+ all_browsers_closing_ = browsers_closing;
+}
+
+bool SessionsSyncManager::GetAllBrowsersClosingForTesting() {
+ return all_browsers_closing_;
+}
+
void SessionsSyncManager::StopSyncing(syncer::ModelType type) {
local_event_router_->Stop();
if (sync_processor_.get() && lost_navigations_recorder_.get()) {
« no previous file with comments | « components/sync_sessions/sessions_sync_manager.h ('k') | components/sync_sessions/sessions_sync_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698