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

Side by Side Diff: chrome/browser/android/metrics/uma_session_stats.cc

Issue 2142983002: Add desktop engagement metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 4 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 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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chrome_browser_main.cc » ('j') | chrome/browser/chrome_browser_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698