Chromium Code Reviews| 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_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 ++active_session_count_; | 54 ++active_session_count_; |
| 55 } | 55 } |
| 56 | 56 |
| 57 void UmaSessionStats::UmaEndSession(JNIEnv* env, | 57 void UmaSessionStats::UmaEndSession(JNIEnv* env, |
| 58 const JavaParamRef<jobject>& obj) { | 58 const JavaParamRef<jobject>& obj) { |
| 59 --active_session_count_; | 59 --active_session_count_; |
| 60 DCHECK_GE(active_session_count_, 0); | 60 DCHECK_GE(active_session_count_, 0); |
| 61 | 61 |
| 62 if (active_session_count_ == 0) { | 62 if (active_session_count_ == 0) { |
| 63 base::TimeDelta duration = base::TimeTicks::Now() - session_start_time_; | 63 base::TimeDelta duration = base::TimeTicks::Now() - session_start_time_; |
| 64 | |
| 65 // This metric is recorded separately for desktops in | |
|
Alexei Svitkine (slow)
2016/07/28 18:37:22
Nit: "for desktops" -> "on desktop"
Add a "Note:
gayane -on leave until 09-2017
2016/07/28 21:21:34
Done.
| |
| 66 // DesktopEngagementService::EndSession. | |
| 64 UMA_HISTOGRAM_LONG_TIMES("Session.TotalDuration", duration); | 67 UMA_HISTOGRAM_LONG_TIMES("Session.TotalDuration", duration); |
| 65 | 68 |
| 66 DCHECK(g_browser_process); | 69 DCHECK(g_browser_process); |
| 67 // Tell the metrics service it was cleanly shutdown. | 70 // Tell the metrics service it was cleanly shutdown. |
| 68 metrics::MetricsService* metrics = g_browser_process->metrics_service(); | 71 metrics::MetricsService* metrics = g_browser_process->metrics_service(); |
| 69 if (metrics) { | 72 if (metrics) { |
| 70 metrics->OnAppEnterBackground(); | 73 metrics->OnAppEnterBackground(); |
| 71 } | 74 } |
| 72 } | 75 } |
| 73 } | 76 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 // We should have only one UmaSessionStats instance. | 197 // We should have only one UmaSessionStats instance. |
| 195 DCHECK(!g_uma_session_stats); | 198 DCHECK(!g_uma_session_stats); |
| 196 g_uma_session_stats = new UmaSessionStats(); | 199 g_uma_session_stats = new UmaSessionStats(); |
| 197 return reinterpret_cast<intptr_t>(g_uma_session_stats); | 200 return reinterpret_cast<intptr_t>(g_uma_session_stats); |
| 198 } | 201 } |
| 199 | 202 |
| 200 // Register native methods | 203 // Register native methods |
| 201 bool RegisterUmaSessionStats(JNIEnv* env) { | 204 bool RegisterUmaSessionStats(JNIEnv* env) { |
| 202 return RegisterNativesImpl(env); | 205 return RegisterNativesImpl(env); |
| 203 } | 206 } |
| OLD | NEW |