| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DRIVER_TAB_NODE_POOL_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_TAB_NODE_POOL_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_TAB_NODE_POOL_H_ | 6 #define COMPONENTS_SYNC_DRIVER_TAB_NODE_POOL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // If free nodes > kFreeNodesHighWatermark, delete all free nodes until | 48 // If free nodes > kFreeNodesHighWatermark, delete all free nodes until |
| 49 // free nodes <= kFreeNodesLowWatermark. | 49 // free nodes <= kFreeNodesLowWatermark. |
| 50 static const size_t kFreeNodesLowWatermark; | 50 static const size_t kFreeNodesLowWatermark; |
| 51 | 51 |
| 52 // Maximum limit of FreeNodes allowed on the client. | 52 // Maximum limit of FreeNodes allowed on the client. |
| 53 static const size_t kFreeNodesHighWatermark; | 53 static const size_t kFreeNodesHighWatermark; |
| 54 | 54 |
| 55 static const int kInvalidTabNodeID; | 55 static const int kInvalidTabNodeID; |
| 56 | 56 |
| 57 // Build a sync tag from tab_node_id. | 57 // Build a sync tag from tab_node_id. |
| 58 static std::string TabIdToTag(const std::string machine_tag, | 58 static std::string TabIdToTag(const std::string& machine_tag, |
| 59 int tab_node_id); | 59 int tab_node_id); |
| 60 | 60 |
| 61 // Returns the tab_node_id for the next free tab node. If none are available, | 61 // Returns the tab_node_id for the next free tab node. If none are available, |
| 62 // creates a new tab node and adds it to free nodes pool. The free node can | 62 // creates a new tab node and adds it to free nodes pool. The free node can |
| 63 // then be used to associate with a tab by calling AssociateTabNode. | 63 // then be used to associate with a tab by calling AssociateTabNode. |
| 64 // Note: The node is considered free until it has been associated. Repeated | 64 // Note: The node is considered free until it has been associated. Repeated |
| 65 // calls to GetFreeTabNode will return the same id until node has been | 65 // calls to GetFreeTabNode will return the same id until node has been |
| 66 // associated. | 66 // associated. |
| 67 // |change_output| *must* be provided. It is the TabNodePool's link to | 67 // |change_output| *must* be provided. It is the TabNodePool's link to |
| 68 // the SyncChange pipeline that exists in the caller context. If the need | 68 // the SyncChange pipeline that exists in the caller context. If the need |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // The machine tag associated with this tab pool. Used in the title of new | 155 // The machine tag associated with this tab pool. Used in the title of new |
| 156 // sync nodes. | 156 // sync nodes. |
| 157 std::string machine_tag_; | 157 std::string machine_tag_; |
| 158 | 158 |
| 159 DISALLOW_COPY_AND_ASSIGN(TabNodePool); | 159 DISALLOW_COPY_AND_ASSIGN(TabNodePool); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 } // namespace browser_sync | 162 } // namespace browser_sync |
| 163 | 163 |
| 164 #endif // COMPONENTS_SYNC_DRIVER_TAB_NODE_POOL_H_ | 164 #endif // COMPONENTS_SYNC_DRIVER_TAB_NODE_POOL_H_ |
| OLD | NEW |