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

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: Reverting now inaccurate comments from previous versions. 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 // All of the known to be valid tab node ids associated with this session.
Nicolas Zea 2016/04/12 20:38:03 Why mention "known to be valid"? Also "stored in
skym 2016/04/12 22:12:14 Yeah, I have no idea what I was thinking when I ty
Nicolas Zea 2016/04/14 18:17:25 Much clearer, thanks!
64 // This is not stored in the header, but rather assembled for all tabs, both
65 // parented and orphaned.
66 std::set<int> tab_node_ids;
67
61 // Converts the DeviceType enum value to a string. This is used 68 // Converts the DeviceType enum value to a string. This is used
62 // in the NTP handler for foreign sessions for matching session 69 // in the NTP handler for foreign sessions for matching session
63 // types to an icon style. 70 // types to an icon style.
64 std::string DeviceTypeAsString() const { 71 std::string DeviceTypeAsString() const {
65 switch (device_type) { 72 switch (device_type) {
66 case SyncedSession::TYPE_WIN: 73 case SyncedSession::TYPE_WIN:
67 return "win"; 74 return "win";
68 case SyncedSession::TYPE_MACOSX: 75 case SyncedSession::TYPE_MACOSX:
69 return "macosx"; 76 return "macosx";
70 case SyncedSession::TYPE_LINUX: 77 case SyncedSession::TYPE_LINUX:
(...skipping 15 matching lines...) Expand all
86 // does not create SessionTab protobufs. 93 // does not create SessionTab protobufs.
87 sync_pb::SessionHeader ToSessionHeader() const; 94 sync_pb::SessionHeader ToSessionHeader() const;
88 95
89 private: 96 private:
90 DISALLOW_COPY_AND_ASSIGN(SyncedSession); 97 DISALLOW_COPY_AND_ASSIGN(SyncedSession);
91 }; 98 };
92 99
93 } // namespace sync_driver 100 } // namespace sync_driver
94 101
95 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_ 102 #endif // COMPONENTS_SYNC_SESSIONS_SYNCED_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698