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

Unified Diff: content/renderer/media/render_media_log.cc

Issue 2687583002: Add support for single sample metrics. (Closed)
Patch Set: Add mojo approach. Created 3 years, 10 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
Index: content/renderer/media/render_media_log.cc
diff --git a/content/renderer/media/render_media_log.cc b/content/renderer/media/render_media_log.cc
index 1169f685b5a81ec6885ef39e92a8cb96195c0301..1fced0adcd057e4a0dd85f95f8eb64fb51805ee8 100644
--- a/content/renderer/media/render_media_log.cc
+++ b/content/renderer/media/render_media_log.cc
@@ -12,10 +12,12 @@
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/default_tick_clock.h"
+#include "content/common/metrics.mojom.h"
#include "content/common/view_messages.h"
#include "content/public/common/content_client.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/renderer/render_thread.h"
+#include "services/service_manager/public/cpp/interface_provider.h"
#ifndef MEDIA_EVENT_LOG_UTILITY
#define MEDIA_EVENT_LOG_UTILITY DVLOG(1)
@@ -50,6 +52,18 @@ RenderMediaLog::RenderMediaLog(const GURL& security_origin)
ipc_send_pending_(false) {
DCHECK(RenderThread::Get())
<< "RenderMediaLog must be constructed on the render thread";
+
+ mojom::OneShotMetricHostPtr one_shot_metric;
bcwhite 2017/02/21 12:37:54 Why is the renderer accessing a "host" object?
DaleCurtis 2017/02/21 17:54:29 Eh, it's just the naming scheme commonly used by m
+ RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&one_shot_metric);
+ one_shot_metric->Initialize("Media.UnderflowCount", 1, 100, 50);
+ one_shot_metric->SetSample(5);
+ one_shot_metric->SetSample(7);
+
+ mojom::OneShotMetricHostPtr one_shot_metric2;
+ RenderThread::Get()->GetRemoteInterfaces()->GetInterface(&one_shot_metric2);
+ one_shot_metric2->Initialize("Media.UnderflowCount", 1, 100, 50);
+ one_shot_metric2->SetSample(70);
+ one_shot_metric2->SetSample(100);
}
void RenderMediaLog::AddEvent(std::unique_ptr<media::MediaLogEvent> event) {

Powered by Google App Engine
This is Rietveld 408576698