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