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_SESSIONS_TAB_NODE_POOL_H_ | 5 #ifndef COMPONENTS_SYNC_SESSIONS_TAB_NODE_POOL_H_ |
6 #define COMPONENTS_SYNC_SESSIONS_TAB_NODE_POOL_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_TAB_NODE_POOL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 14 matching lines...) Expand all Loading... |
25 // tab_tag = StringPrintf("%s %d", local_session_tag, tab_node_id); | 25 // tab_tag = StringPrintf("%s %d", local_session_tag, tab_node_id); |
26 // | 26 // |
27 // A sync node can be in one of the two states: | 27 // A sync node can be in one of the two states: |
28 // 1. Associated : Sync node is used and associated with a tab. | 28 // 1. Associated : Sync node is used and associated with a tab. |
29 // 2. Free : Sync node is unused. | 29 // 2. Free : Sync node is unused. |
30 | 30 |
31 class TabNodePool { | 31 class TabNodePool { |
32 public: | 32 public: |
33 TabNodePool(); | 33 TabNodePool(); |
34 ~TabNodePool(); | 34 ~TabNodePool(); |
35 enum InvalidTab { kInvalidTabID = -1 }; | |
36 | 35 |
37 // If free nodes > kFreeNodesHighWatermark, delete all free nodes until | 36 // If free nodes > kFreeNodesHighWatermark, delete all free nodes until |
38 // free nodes <= kFreeNodesLowWatermark. | 37 // free nodes <= kFreeNodesLowWatermark. |
39 static const size_t kFreeNodesLowWatermark; | 38 static const size_t kFreeNodesLowWatermark; |
40 | 39 |
41 // Maximum limit of FreeNodes allowed on the client. | 40 // Maximum limit of FreeNodes allowed on the client. |
42 static const size_t kFreeNodesHighWatermark; | 41 static const size_t kFreeNodesHighWatermark; |
43 | 42 |
44 static const int kInvalidTabNodeID; | 43 static const int kInvalidTabNodeID; |
45 | 44 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // The maximum used tab_node id for a sync node. A new sync node will always | 110 // The maximum used tab_node id for a sync node. A new sync node will always |
112 // be created with max_used_tab_node_id_ + 1. | 111 // be created with max_used_tab_node_id_ + 1. |
113 int max_used_tab_node_id_; | 112 int max_used_tab_node_id_; |
114 | 113 |
115 DISALLOW_COPY_AND_ASSIGN(TabNodePool); | 114 DISALLOW_COPY_AND_ASSIGN(TabNodePool); |
116 }; | 115 }; |
117 | 116 |
118 } // namespace sync_sessions | 117 } // namespace sync_sessions |
119 | 118 |
120 #endif // COMPONENTS_SYNC_SESSIONS_TAB_NODE_POOL_H_ | 119 #endif // COMPONENTS_SYNC_SESSIONS_TAB_NODE_POOL_H_ |
OLD | NEW |