OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_SYNC_SESSIONS2_SESSIONS_SYNC_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SESSIONS2_SESSIONS_SYNC_MANAGER_H_ |
6 #define CHROME_BROWSER_SYNC_SESSIONS2_SESSIONS_SYNC_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_SESSIONS2_SESSIONS_SYNC_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 | 139 |
140 // Return the virtual URL of the current tab, even if it's pending. | 140 // Return the virtual URL of the current tab, even if it's pending. |
141 static GURL GetCurrentVirtualURL(const SyncedTabDelegate& tab_delegate); | 141 static GURL GetCurrentVirtualURL(const SyncedTabDelegate& tab_delegate); |
142 | 142 |
143 // Return the favicon url of the current tab, even if it's pending. | 143 // Return the favicon url of the current tab, even if it's pending. |
144 static GURL GetCurrentFaviconURL(const SyncedTabDelegate& tab_delegate); | 144 static GURL GetCurrentFaviconURL(const SyncedTabDelegate& tab_delegate); |
145 | 145 |
146 FaviconCache* GetFaviconCache(); | 146 FaviconCache* GetFaviconCache(); |
147 | 147 |
| 148 // Triggers garbage collection of stale sessions (as defined by |
| 149 // |stale_session_threshold_days_|). This is called automatically every |
| 150 // time we start up (via AssociateModels) and when new sessions data is |
| 151 // downloaded (sync cycles complete). |
| 152 void DoGarbageCollection(); |
| 153 |
148 private: | 154 private: |
149 // Keep all the links to local tab data in one place. A tab_node_id and tab | 155 // Keep all the links to local tab data in one place. A tab_node_id and tab |
150 // must be passed at creation. The tab_node_id is not mutable, although | 156 // must be passed at creation. The tab_node_id is not mutable, although |
151 // all other fields are. | 157 // all other fields are. |
152 class TabLink { | 158 class TabLink { |
153 public: | 159 public: |
154 TabLink(int tab_node_id, const SyncedTabDelegate* tab) | 160 TabLink(int tab_node_id, const SyncedTabDelegate* tab) |
155 : tab_node_id_(tab_node_id), | 161 : tab_node_id_(tab_node_id), |
156 tab_(tab) {} | 162 tab_(tab) {} |
157 | 163 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 // Unique client tag. | 328 // Unique client tag. |
323 std::string current_machine_tag_; | 329 std::string current_machine_tag_; |
324 | 330 |
325 // User-visible machine name. | 331 // User-visible machine name. |
326 std::string current_session_name_; | 332 std::string current_session_name_; |
327 | 333 |
328 // SyncID for the sync node containing all the window information for this | 334 // SyncID for the sync node containing all the window information for this |
329 // client. | 335 // client. |
330 int local_session_header_node_id_; | 336 int local_session_header_node_id_; |
331 | 337 |
| 338 // Number of days without activity after which we consider a session to be |
| 339 // stale and a candidate for garbage collection. |
| 340 size_t stale_session_threshold_days_; |
| 341 |
332 scoped_ptr<LocalSessionEventRouter> local_event_router_; | 342 scoped_ptr<LocalSessionEventRouter> local_event_router_; |
333 | 343 |
334 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); | 344 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); |
335 }; | 345 }; |
336 | 346 |
337 } // namespace browser_sync | 347 } // namespace browser_sync |
338 | 348 |
339 #endif // CHROME_BROWSER_SYNC_SESSIONS2_SESSIONS_SYNC_MANAGER_H_ | 349 #endif // CHROME_BROWSER_SYNC_SESSIONS2_SESSIONS_SYNC_MANAGER_H_ |
OLD | NEW |