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

Unified Diff: components/sync_sessions/synced_session_tracker.cc

Issue 2507543002: Revert of [Sync] Put session tracker in charge of maintaining local state. (Closed)
Patch Set: Created 4 years, 1 month 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/synced_session_tracker.cc
diff --git a/components/sync_sessions/synced_session_tracker.cc b/components/sync_sessions/synced_session_tracker.cc
index 52385d70fafa5bf4cbbd906c6ce699223a97f91b..a74b877c085c11e890af5c51567516596c8d01be 100644
--- a/components/sync_sessions/synced_session_tracker.cc
+++ b/components/sync_sessions/synced_session_tracker.cc
@@ -339,48 +339,6 @@
return tab_ptr;
}
-bool SyncedSessionTracker::ReassociateTab(const std::string& session_tag,
- SessionID::id_type old_tab_id,
- SessionID::id_type new_tab_id) {
- DCHECK_NE(TabNodePool::kInvalidTabID, old_tab_id);
- DCHECK_NE(TabNodePool::kInvalidTabID, new_tab_id);
-
- sessions::SessionTab* tab_ptr = nullptr;
- auto old_tab_iter = synced_tab_map_[session_tag].find(old_tab_id);
- if (old_tab_iter == synced_tab_map_[session_tag].end())
- return false;
-
- // It's possible a placeholder is already in place for the new tab. If that's
- // the case, reuse the placeholder SessionTab. Otherwise, reuse the old
- // SessionTab.
- auto new_tab_iter = synced_tab_map_[session_tag].find(new_tab_id);
- if (new_tab_iter != synced_tab_map_[session_tag].end()) {
- tab_ptr = new_tab_iter->second;
- } else {
- tab_ptr = old_tab_iter->second;
- }
-
- // If the old tab is unmapped, update the tab id under which it is indexed.
- auto unmapped_tabs_iter = unmapped_tabs_[session_tag].find(old_tab_id);
- if (unmapped_tabs_iter != unmapped_tabs_[session_tag].end()) {
- std::unique_ptr<sessions::SessionTab> tab =
- std::move(unmapped_tabs_iter->second);
- unmapped_tabs_[session_tag].erase(unmapped_tabs_iter);
- unmapped_tabs_[session_tag][new_tab_id] = std::move(tab);
- }
-
- // Update the tab id.
- DVLOG(1) << "Remapped tab " << old_tab_id << " to tab " << new_tab_id;
- tab_ptr->tab_id.set_id(new_tab_id);
-
- // Remove the tab from the synced tab map under the old id.
- synced_tab_map_[session_tag].erase(old_tab_iter);
-
- // Add the tab back into the tab map with the new id.
- synced_tab_map_[session_tag][new_tab_id] = tab_ptr;
- return true;
-}
-
void SyncedSessionTracker::Clear() {
// Cleanup unmapped tabs and windows.
unmapped_windows_.clear();
« no previous file with comments | « components/sync_sessions/synced_session_tracker.h ('k') | components/sync_sessions/synced_session_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698