| Index: chrome/browser/sync/glue/tab_node_pool.h
|
| diff --git a/chrome/browser/sync/glue/tab_node_pool.h b/chrome/browser/sync/glue/tab_node_pool.h
|
| index 8327d061e08551ecf4fb835e39b06b80f1a613f5..299d9ae710f1cddf7607f60c6ff0b65c85e40c1e 100644
|
| --- a/chrome/browser/sync/glue/tab_node_pool.h
|
| +++ b/chrome/browser/sync/glue/tab_node_pool.h
|
| @@ -23,14 +23,14 @@ class TabNodePool {
|
|
|
| // Build a sync tag from tab_node_id.
|
| static std::string TabIdToTag(const std::string machine_tag,
|
| - size_t tab_node_id);
|
| + int32 tab_node_id);
|
|
|
| // Add a previously allocated tab sync node to our pool. Increases the size
|
| // of tab_syncid_pool_ by one and marks the new tab node as free.
|
| // Note: this should only be called when we discover tab sync nodes from
|
| // previous sessions, not for freeing tab nodes we created through
|
| // GetFreeTabNode (use FreeTabNode below for that).
|
| - void AddTabNode(int64 sync_id);
|
| + void AddTabNode(int64 sync_id, int32 tab_node_id);
|
|
|
| // Returns the sync_id for the next free tab node. If none are available,
|
| // creates a new tab node.
|
| @@ -53,16 +53,22 @@ class TabNodePool {
|
| // the |tab_syncid_pool_| should always be equal to the amount of tab nodes
|
| // associated with this machine.
|
| void FreeTabNode(int64 sync_id);
|
| + int64 GetOldSyncNode(const int64 sync_node_id);
|
| +
|
| + void PurgeOldSyncNodes(std::vector<int64>& used_sync_ids);
|
|
|
| // Clear tab pool.
|
| void clear() {
|
| tab_syncid_pool_.clear();
|
| + old_sync_ids.clear();
|
| tab_pool_fp_ = -1;
|
| }
|
|
|
| // Return the number of tab nodes this client currently has allocated
|
| // (including both free and used nodes)
|
| - size_t capacity() const { return tab_syncid_pool_.size(); }
|
| + size_t capacity() const {
|
| + return tab_syncid_pool_.size() + old_sync_ids.size();
|
| + }
|
|
|
| // Return empty status (all tab nodes are in use).
|
| bool empty() const { return tab_pool_fp_ == -1; }
|
| @@ -77,9 +83,20 @@ class TabNodePool {
|
| }
|
|
|
| private:
|
| +
|
| + /* The maximum used tab node id, when creating a new sync node we used
|
| + * max_used_tab_node_id_ + 1 */
|
| + int32 max_used_tab_node_id_;
|
| +
|
| // Pool of all available syncid's for tab's we have created.
|
| std::vector<int64> tab_syncid_pool_;
|
|
|
| + // Pool containing unused sync nodes as a result of session restore.
|
| + std::vector<int64> session_restore_syncid_nodes_pool_;
|
| +
|
| + // typedef std::pair<int64, int32> sync_node_pair;
|
| + std::vector<int64> old_sync_ids;
|
| +
|
| // Free pointer for tab pool. Only those node id's, up to and including the
|
| // one indexed by the free pointer, are valid and free. The rest of the
|
| // |tab_syncid_pool_| is invalid because the nodes are in use.
|
|
|