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

Unified Diff: components/sync_sessions/synced_session_tracker.h

Issue 2494533002: [Sync] Put session tracker in charge of maintaining local state. (Closed)
Patch Set: Rebase 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.h
diff --git a/components/sync_sessions/synced_session_tracker.h b/components/sync_sessions/synced_session_tracker.h
index 35123d76a9ce54e67999f31071da0feac5128723..b1f1cd4043d7dcfc2f386dbf0c6f12d098bc85f3 100644
--- a/components/sync_sessions/synced_session_tracker.h
+++ b/components/sync_sessions/synced_session_tracker.h
@@ -133,6 +133,15 @@ class SyncedSessionTracker {
SessionID::id_type tab_id,
int tab_node_id);
+ // Reassociated the tab denoted by |old_tab_id| with a new tab id.
+ // This is useful on restart when sync needs to reassociate tabs from a
+ // previous session with newly restored tabs (and can be used in conjunction
+ // with PutTabInWindow).
+ // Returns true on success, false on failure.
maxbogue 2016/11/10 06:43:26 nit: I'd prefer "Returns whether the reassociation
Nicolas Zea 2016/11/10 18:25:36 Done.
+ bool ReassociateTab(const std::string& session_tag,
+ SessionID::id_type old_tab_id,
+ SessionID::id_type new_tab_id);
+
// Fills |tab_node_ids| with the tab node ids (see GetTab) for all the tabs*
// associated with the session having tag |session_tag|.
void LookupTabNodeIds(const std::string& session_tag,
@@ -168,12 +177,12 @@ class SyncedSessionTracker {
// The client of the sync sessions datatype.
SyncSessionsClient* const sessions_client_;
- // The mapping of tab/window ids to their SessionTab/SessionWindow objects.
+ // The mapping of tab/window to their SessionTab/SessionWindow objects.
// The SessionTab/SessionWindow objects referred to may be owned either by the
// session in the |synced_session_map_| or be temporarily unmapped and live in
// the |unmapped_tabs_|/|unmapped_windows_| collections.
//
- // Map: session tag -> (tab/window id -> SessionTab*/SessionWindow*)
+ // Map: session tag -> (tab/window -> SessionTab*/SessionWindow*)
std::map<std::string, std::map<SessionID::id_type, sessions::SessionTab*>>
synced_tab_map_;
std::map<std::string, std::map<SessionID::id_type, sessions::SessionWindow*>>

Powered by Google App Engine
This is Rietveld 408576698