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

Side by Side Diff: components/sync_sessions/sync_sessions_metrics.cc

Issue 2499023004: [Sync] Introduce SyncedSessionWindow type. (Closed)
Patch Set: Fix compile Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/sync_sessions/sync_sessions_metrics.h" 5 #include "components/sync_sessions/sync_sessions_metrics.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // While Sessions are ordered by recency, windows and tabs are not. Because 44 // While Sessions are ordered by recency, windows and tabs are not. Because
45 // the timestamp of sessions are updated when windows/tabs are removed, we 45 // the timestamp of sessions are updated when windows/tabs are removed, we
46 // only need to search until all the remaining sessions are older than the 46 // only need to search until all the remaining sessions are older than the
47 // most recent tab we've found so far. 47 // most recent tab we've found so far.
48 base::Time best(base::Time::UnixEpoch()); 48 base::Time best(base::Time::UnixEpoch());
49 for (const SyncedSession* session : sessions) { 49 for (const SyncedSession* session : sessions) {
50 if (session->modified_time < best) { 50 if (session->modified_time < best) {
51 break; 51 break;
52 } 52 }
53 for (const auto& key_value : session->windows) { 53 for (const auto& key_value : session->windows) {
54 for (const auto& tab : key_value.second->tabs) { 54 for (const auto& tab : key_value.second->wrapped_window.tabs) {
55 best = std::max(best, tab->timestamp); 55 best = std::max(best, tab->timestamp);
56 } 56 }
57 } 57 }
58 } 58 }
59 return best; 59 return best;
60 } 60 }
61 61
62 } // namespace sync_sessions 62 } // namespace sync_sessions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698