Index: content/browser/media/audible_metrics.h |
diff --git a/content/browser/media/audible_metrics.h b/content/browser/media/audible_metrics.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..96ced6304380647dad368f51ec3b2dfaa94b9864 |
--- /dev/null |
+++ b/content/browser/media/audible_metrics.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_ |
+#define CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_ |
+ |
+#include <set> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "base/time/clock.h" |
+#include "content/common/content_export.h" |
+ |
+namespace content { |
+ |
+class WebContents; |
+ |
+// This class handles metrics regarding audible WebContents. |
+// It does register three different information: |
whywhat
2016/01/15 19:01:19
nit: s/%/It reports three different metrics/ ?
|
+// - how many WebContents are audible when a WebContents become audible. |
+// - how long multiple WebContents are audible at the same time. |
+// - for a browsing session, how often and how many WebContents get audible at |
+// the same time. |
+class CONTENT_EXPORT AudibleMetrics { |
+ public: |
+ AudibleMetrics(); |
+ ~AudibleMetrics(); |
+ |
+ void UpdateAudibleWebContentsState(WebContents* web_contents, bool audible); |
DaleCurtis
2016/01/15 19:02:03
const all usage of WebContents* in this class.
mlamouri (slow - plz ping)
2016/01/19 19:26:36
Done.
|
+ |
+ void SetClockForTest(scoped_ptr<base::Clock> testing_clock); |
+ |
+ private: |
+ void AddAudibleWebContents(WebContents* web_contents); |
+ void RemoveAudibleWebContents(WebContents* web_contents); |
+ |
+ base::Time concurrent_web_contents_start_time_; |
DaleCurtis
2016/01/15 19:02:03
TimeTicks
DaleCurtis
2016/01/19 18:36:53
Don't see any resolution or discussion of this com
mlamouri (slow - plz ping)
2016/01/19 19:26:36
I think I missed the first file entirely. Sorry ab
|
+ size_t max_concurrent_audible_web_contents_in_session_; |
+ scoped_ptr<base::Clock> clock_; |
DaleCurtis
2016/01/15 19:02:03
TickClock to avoid time going backwards issues
mlamouri (slow - plz ping)
2016/01/19 19:26:36
Done.
|
+ |
+ std::set<WebContents*> audible_web_contents_; |
+}; |
DaleCurtis
2016/01/15 19:02:03
DISALLOW_COPY_AND_ASSIGN
mlamouri (slow - plz ping)
2016/01/19 19:26:36
Done.
|
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_ |