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