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

Unified Diff: content/browser/media/audible_metrics.h

Issue 1618523003: Merge of "Add metrics regarding concurrent audible tabs in Chromium." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/media/audible_metrics.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..408bc8cba2744355317d661e128609813c3e7655
--- /dev/null
+++ b/content/browser/media/audible_metrics.h
@@ -0,0 +1,49 @@
+// 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/tick_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:
+// - 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(const WebContents* web_contents,
+ bool audible);
+
+ void SetClockForTest(scoped_ptr<base::TickClock> test_clock);
+
+ private:
+ void AddAudibleWebContents(const WebContents* web_contents);
+ void RemoveAudibleWebContents(const WebContents* web_contents);
+
+ base::TimeTicks concurrent_web_contents_start_time_;
+ size_t max_concurrent_audible_web_contents_in_session_;
+ scoped_ptr<base::TickClock> clock_;
+
+ std::set<const WebContents*> audible_web_contents_;
+
+ DISALLOW_COPY_AND_ASSIGN(AudibleMetrics);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_
« no previous file with comments | « no previous file | content/browser/media/audible_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698