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

Side by Side Diff: content/browser/media/session/media_session_uma_helper.h

Issue 1918433003: Use TimeTicks for MediaSessionUmaHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_
6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_ 6 #define CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/time/clock.h" 10 #include "base/time/clock.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 12
13 namespace base { 13 namespace base {
14 class Clock; 14 class TickClock;
15 } // base namespace 15 } // base namespace
16 16
17 namespace content { 17 namespace content {
18 18
19 class CONTENT_EXPORT MediaSessionUmaHelper { 19 class CONTENT_EXPORT MediaSessionUmaHelper {
20 public: 20 public:
21 // This is used for UMA histogram (Media.Session.Suspended). New values should 21 // This is used for UMA histogram (Media.Session.Suspended). New values should
22 // be appended only and must be added before |Count|. 22 // be appended only and must be added before |Count|.
23 enum class MediaSessionSuspendedSource { 23 enum class MediaSessionSuspendedSource {
24 SystemTransient = 0, 24 SystemTransient = 0,
25 SystemPermanent = 1, 25 SystemPermanent = 1,
26 UI = 2, 26 UI = 2,
27 CONTENT = 3, 27 CONTENT = 3,
28 SystemTransientDuck = 4, 28 SystemTransientDuck = 4,
29 Count // Leave at the end. 29 Count // Leave at the end.
30 }; 30 };
31 31
32 MediaSessionUmaHelper(); 32 MediaSessionUmaHelper();
33 ~MediaSessionUmaHelper(); 33 ~MediaSessionUmaHelper();
34 34
35 void RecordSessionSuspended(MediaSessionSuspendedSource source) const; 35 void RecordSessionSuspended(MediaSessionSuspendedSource source) const;
36 36
37 // Record the result of calling the native requestAudioFocus(). 37 // Record the result of calling the native requestAudioFocus().
38 void RecordRequestAudioFocusResult(bool result) const; 38 void RecordRequestAudioFocusResult(bool result) const;
39 39
40 void OnSessionActive(); 40 void OnSessionActive();
41 void OnSessionSuspended(); 41 void OnSessionSuspended();
42 void OnSessionInactive(); 42 void OnSessionInactive();
43 43
44 void SetClockForTest(std::unique_ptr<base::Clock> testing_clock); 44 void SetClockForTest(std::unique_ptr<base::TickClock> testing_clock);
45 45
46 private: 46 private:
47 base::TimeDelta total_active_time_; 47 base::TimeDelta total_active_time_;
48 base::Time current_active_time_; 48 base::TimeTicks current_active_time_;
49 std::unique_ptr<base::Clock> clock_; 49 std::unique_ptr<base::TickClock> clock_;
50 }; 50 };
51 51
52 } // namespace content 52 } // namespace content
53 53
54 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_ 54 #endif // CONTENT_BROWSER_MEDIA_SESSION_MEDIA_SESSION_UMA_HELPER_H_
OLDNEW
« no previous file with comments | « content/browser/media/session/media_session_browsertest.cc ('k') | content/browser/media/session/media_session_uma_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698