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

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

Issue 2461463002: [Sync] Replacing NULL with nullptr/null throughout sync code. (Closed)
Patch Set: Reverted PROFILE_nullptr mistake. Created 4 years, 1 month 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"
11 #include "base/metrics/histogram_macros.h" 11 #include "base/metrics/histogram_macros.h"
12 #include "base/metrics/user_metrics.h" 12 #include "base/metrics/user_metrics.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "components/sessions/core/session_types.h" 14 #include "components/sessions/core/session_types.h"
15 #include "components/sync_sessions/sessions_sync_manager.h" 15 #include "components/sync_sessions/sessions_sync_manager.h"
16 #include "components/sync_sessions/synced_session.h" 16 #include "components/sync_sessions/synced_session.h"
17 17
18 namespace sync_sessions { 18 namespace sync_sessions {
19 19
20 // static 20 // static
21 void SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP( 21 void SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP(
22 SessionsSyncManager* sessions_sync_manager) { 22 SessionsSyncManager* sessions_sync_manager) {
23 if (sessions_sync_manager != NULL) { 23 if (sessions_sync_manager != nullptr) {
24 std::vector<const SyncedSession*> foreign_sessions; 24 std::vector<const SyncedSession*> foreign_sessions;
25 sessions_sync_manager->GetAllForeignSessions(&foreign_sessions); 25 sessions_sync_manager->GetAllForeignSessions(&foreign_sessions);
26 base::Time best(MaxTabTimestamp(foreign_sessions)); 26 base::Time best(MaxTabTimestamp(foreign_sessions));
27 base::Time now(base::Time::Now()); 27 base::Time now(base::Time::Now());
28 // Don't emit metrics if the foreign tab is timestamped in the future. While 28 // Don't emit metrics if the foreign tab is timestamped in the future. While
29 // the timestamp is set on a different machine, and we may lose some 29 // the timestamp is set on a different machine, and we may lose some
30 // fraction of metrics to clock skew, we don't want the potential to have 30 // fraction of metrics to clock skew, we don't want the potential to have
31 // bad machines with clocks many hours off causing lots of seemingly 0 31 // bad machines with clocks many hours off causing lots of seemingly 0
32 // second entries. 32 // second entries.
33 if (base::Time::UnixEpoch() < best && best <= now) { 33 if (base::Time::UnixEpoch() < best && best <= now) {
(...skipping 19 matching lines...) Expand all
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->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
« 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