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

Side by Side Diff: content/browser/media/android/media_session_uma_helper.cc

Issue 1579613003: Add UMA to check whether requestAudioFocus() is successful. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 "content/browser/media/android/media_session_uma_helper.h" 5 #include "content/browser/media/android/media_session_uma_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram_base.h" 9 #include "base/metrics/histogram_base.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 11 matching lines...) Expand all
22 {} 22 {}
23 23
24 void MediaSessionUmaHelper::RecordSessionSuspended( 24 void MediaSessionUmaHelper::RecordSessionSuspended(
25 MediaSessionSuspendedSource source) const { 25 MediaSessionSuspendedSource source) const {
26 UMA_HISTOGRAM_ENUMERATION( 26 UMA_HISTOGRAM_ENUMERATION(
27 "Media.Session.Suspended", 27 "Media.Session.Suspended",
28 static_cast<HistogramBase::Sample>(source), 28 static_cast<HistogramBase::Sample>(source),
29 static_cast<HistogramBase::Sample>(MediaSessionSuspendedSource::Count)); 29 static_cast<HistogramBase::Sample>(MediaSessionSuspendedSource::Count));
30 } 30 }
31 31
32 void MediaSessionUmaHelper::RecordRequestAudioFocusResult(bool result) const {
33 UMA_HISTOGRAM_BOOLEAN("Media.Session.RequestAudioFocusResult", result);
34 }
35
32 void MediaSessionUmaHelper::OnSessionActive() { 36 void MediaSessionUmaHelper::OnSessionActive() {
33 current_active_time_ = clock_->Now(); 37 current_active_time_ = clock_->Now();
34 } 38 }
35 39
36 void MediaSessionUmaHelper::OnSessionSuspended() { 40 void MediaSessionUmaHelper::OnSessionSuspended() {
37 if (current_active_time_.is_null()) 41 if (current_active_time_.is_null())
38 return; 42 return;
39 43
40 total_active_time_ += clock_->Now() - current_active_time_; 44 total_active_time_ += clock_->Now() - current_active_time_;
41 current_active_time_ = base::Time(); 45 current_active_time_ = base::Time();
(...skipping 11 matching lines...) Expand all
53 UMA_HISTOGRAM_LONG_TIMES("Media.Session.ActiveTime", total_active_time_); 57 UMA_HISTOGRAM_LONG_TIMES("Media.Session.ActiveTime", total_active_time_);
54 total_active_time_ = base::TimeDelta(); 58 total_active_time_ = base::TimeDelta();
55 } 59 }
56 60
57 void MediaSessionUmaHelper::SetClockForTest( 61 void MediaSessionUmaHelper::SetClockForTest(
58 scoped_ptr<base::Clock> testing_clock) { 62 scoped_ptr<base::Clock> testing_clock) {
59 clock_ = std::move(testing_clock); 63 clock_ = std::move(testing_clock);
60 } 64 }
61 65
62 } // namespace content 66 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/android/media_session_uma_helper.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698