Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1263)

Side by Side Diff: components/sync_sessions/synced_session.h

Issue 1877083002: [Sync] Moved tab_node_id tracking to session object and improved foreign session garbage collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing comment for zea. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_SYNCED_SESSION_H_ 5 #ifndef COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_
6 #define COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_ 6 #define COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set>
9 #include <string> 10 #include <string>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "components/sessions/core/session_id.h" 14 #include "components/sessions/core/session_id.h"
14 #include "components/sessions/core/session_types.h" 15 #include "components/sessions/core/session_types.h"
15 #include "sync/protocol/session_specifics.pb.h" 16 #include "sync/protocol/session_specifics.pb.h"
16 17
17 namespace sessions { 18 namespace sessions {
18 struct SessionWindow; 19 struct SessionWindow;
(...skipping 25 matching lines...) Expand all
44 ~SyncedSession(); 45 ~SyncedSession();
45 46
46 // Unique tag for each session. 47 // Unique tag for each session.
47 std::string session_tag; 48 std::string session_tag;
48 // User-visible name 49 // User-visible name
49 std::string session_name; 50 std::string session_name;
50 51
51 // Type of device this session is from. 52 // Type of device this session is from.
52 DeviceType device_type; 53 DeviceType device_type;
53 54
54 // Last time this session was modified remotely. 55 // Last time this session was modified remotely. This is the max of the header
56 // and all children tab mtimes.
55 base::Time modified_time; 57 base::Time modified_time;
56 58
57 // Map of windows that make up this session. Windowws are owned by the session 59 // Map of windows that make up this session. Windowws are owned by the session
58 // itself and free'd on destruction. 60 // itself and free'd on destruction.
59 SyncedWindowMap windows; 61 SyncedWindowMap windows;
60 62
63 // A tab node id is part of the identifier for the sync tab objects. Tab node
64 // ids are not used for interacting with the model/browser tabs. However, when
65 // when we want to delete a foreign session, we use these values to inform
66 // sync which tabs to delete. We are extracting these tab node ids from
67 // individual session (tab, not header) specifics, but store them here in the
68 // SyncedSession during runtime. We do this because tab node ids may be reused
69 // for different tabs, and tracking which tab id is currently associated with
70 // each tab node id is both difficult and unnecessary. See comments at
71 // SyncedSessionTracker::GetTabImpl for a concrete example of id reuse.
72 std::set<int> tab_node_ids;
73
61 // Converts the DeviceType enum value to a string. This is used 74 // Converts the DeviceType enum value to a string. This is used
62 // in the NTP handler for foreign sessions for matching session 75 // in the NTP handler for foreign sessions for matching session
63 // types to an icon style. 76 // types to an icon style.
64 std::string DeviceTypeAsString() const { 77 std::string DeviceTypeAsString() const {
65 switch (device_type) { 78 switch (device_type) {
66 case SyncedSession::TYPE_WIN: 79 case SyncedSession::TYPE_WIN:
67 return "win"; 80 return "win";
68 case SyncedSession::TYPE_MACOSX: 81 case SyncedSession::TYPE_MACOSX:
69 return "macosx"; 82 return "macosx";
70 case SyncedSession::TYPE_LINUX: 83 case SyncedSession::TYPE_LINUX:
(...skipping 15 matching lines...) Expand all
86 // does not create SessionTab protobufs. 99 // does not create SessionTab protobufs.
87 sync_pb::SessionHeader ToSessionHeader() const; 100 sync_pb::SessionHeader ToSessionHeader() const;
88 101
89 private: 102 private:
90 DISALLOW_COPY_AND_ASSIGN(SyncedSession); 103 DISALLOW_COPY_AND_ASSIGN(SyncedSession);
91 }; 104 };
92 105
93 } // namespace sync_driver 106 } // namespace sync_driver
94 107
95 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_ 108 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_
OLDNEW
« no previous file with comments | « components/sync_sessions/sessions_sync_manager.cc ('k') | components/sync_sessions/synced_session_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698