OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_TRACKER_H_ | 5 #ifndef COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_TRACKER_H_ |
6 #define COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_TRACKER_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_TRACKER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 bool GetTabNodeFromLocalTabId(SessionID::id_type tab_id, int* tab_node_id); | 167 bool GetTabNodeFromLocalTabId(SessionID::id_type tab_id, int* tab_node_id); |
168 | 168 |
169 // Returns whether |tab_node_id| refers to a valid tab node that is associated | 169 // Returns whether |tab_node_id| refers to a valid tab node that is associated |
170 // with a tab. | 170 // with a tab. |
171 bool IsLocalTabNodeAssociated(int tab_node_id); | 171 bool IsLocalTabNodeAssociated(int tab_node_id); |
172 | 172 |
173 // Reassociates the tab denoted by |tab_node_id| with a new tab id, preserving | 173 // Reassociates the tab denoted by |tab_node_id| with a new tab id, preserving |
174 // any previous SessionTab object the node was associated with. This is useful | 174 // any previous SessionTab object the node was associated with. This is useful |
175 // on restart when sync needs to reassociate tabs from a previous session with | 175 // on restart when sync needs to reassociate tabs from a previous session with |
176 // newly restored tabs (and can be used in conjunction with PutTabInWindow). | 176 // newly restored tabs (and can be used in conjunction with PutTabInWindow). |
| 177 // If |new_tab_id| is already associated with a tab object, that tab will be |
| 178 // overwritten. Reassociating a tab with a node it is already mapped to will |
| 179 // have no effect. |
177 void ReassociateLocalTab(int tab_node_id, SessionID::id_type new_tab_id); | 180 void ReassociateLocalTab(int tab_node_id, SessionID::id_type new_tab_id); |
178 | 181 |
179 // **** Methods for querying/manipulating overall state ****. | 182 // **** Methods for querying/manipulating overall state ****. |
180 | 183 |
181 // Free the memory for all dynamically allocated objects and clear the | 184 // Free the memory for all dynamically allocated objects and clear the |
182 // tracking structures. | 185 // tracking structures. |
183 void Clear(); | 186 void Clear(); |
184 | 187 |
185 bool Empty() const { | 188 bool Empty() const { |
186 return synced_tab_map_.empty() && synced_session_map_.empty(); | 189 return synced_tab_map_.empty() && synced_session_map_.empty(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 251 |
249 // Pool of used/available sync nodes associated with local tabs. | 252 // Pool of used/available sync nodes associated with local tabs. |
250 TabNodePool local_tab_pool_; | 253 TabNodePool local_tab_pool_; |
251 | 254 |
252 DISALLOW_COPY_AND_ASSIGN(SyncedSessionTracker); | 255 DISALLOW_COPY_AND_ASSIGN(SyncedSessionTracker); |
253 }; | 256 }; |
254 | 257 |
255 } // namespace sync_sessions | 258 } // namespace sync_sessions |
256 | 259 |
257 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_TRACKER_H_ | 260 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_TRACKER_H_ |
OLD | NEW |