OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/metrics/uma_session_stats.h" | 5 #include "chrome/browser/android/metrics/uma_session_stats.h" |
6 | 6 |
7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 void UmaSessionStats::UmaEndSession(JNIEnv* env, | 59 void UmaSessionStats::UmaEndSession(JNIEnv* env, |
60 const JavaParamRef<jobject>& obj) { | 60 const JavaParamRef<jobject>& obj) { |
61 --active_session_count_; | 61 --active_session_count_; |
62 DCHECK_GE(active_session_count_, 0); | 62 DCHECK_GE(active_session_count_, 0); |
63 | 63 |
64 if (active_session_count_ == 0) { | 64 if (active_session_count_ == 0) { |
65 base::TimeDelta duration = base::TimeTicks::Now() - session_start_time_; | 65 base::TimeDelta duration = base::TimeTicks::Now() - session_start_time_; |
66 | 66 |
67 // Note: This metric is recorded separately on desktop in | 67 // Note: This metric is recorded separately on desktop in |
68 // DesktopEngagementService::EndSession. | 68 // DesktopSessionDurationTracker::EndSession. |
69 UMA_HISTOGRAM_LONG_TIMES("Session.TotalDuration", duration); | 69 UMA_HISTOGRAM_LONG_TIMES("Session.TotalDuration", duration); |
70 | 70 |
71 DCHECK(g_browser_process); | 71 DCHECK(g_browser_process); |
72 // Tell the metrics service it was cleanly shutdown. | 72 // Tell the metrics service it was cleanly shutdown. |
73 metrics::MetricsService* metrics = g_browser_process->metrics_service(); | 73 metrics::MetricsService* metrics = g_browser_process->metrics_service(); |
74 if (metrics) { | 74 if (metrics) { |
75 metrics->OnAppEnterBackground(); | 75 metrics->OnAppEnterBackground(); |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 // We should have only one UmaSessionStats instance. | 229 // We should have only one UmaSessionStats instance. |
230 DCHECK(!g_uma_session_stats); | 230 DCHECK(!g_uma_session_stats); |
231 g_uma_session_stats = new UmaSessionStats(); | 231 g_uma_session_stats = new UmaSessionStats(); |
232 return reinterpret_cast<intptr_t>(g_uma_session_stats); | 232 return reinterpret_cast<intptr_t>(g_uma_session_stats); |
233 } | 233 } |
234 | 234 |
235 // Register native methods | 235 // Register native methods |
236 bool RegisterUmaSessionStats(JNIEnv* env) { | 236 bool RegisterUmaSessionStats(JNIEnv* env) { |
237 return RegisterNativesImpl(env); | 237 return RegisterNativesImpl(env); |
238 } | 238 } |
OLD | NEW |