Commit 1461ce85 authored by Daniel Cheng's avatar Daniel Cheng Committed by Commit Bot

Use base histogram functions in //third_party/blink/renderer/modules/mediasource

Blink allows use of the //base histogram helpers, so switch away from
the Blink-specific histogram helpers and standardize on //base. The
long-term goal is to remove the Blink helpers, which differ from the
//base ones in some interesting and surprising ways.

Miscellaneous cleanup:
- use the histogram functions where appropriate (i.e. for metrics that
  aren't recorded on performance-critical paths)
- simplify enum histogram recording by changing the enum metric to be
  an enum class and defining kMaxValue where needed.

Bug: 742517, 1047547
Change-Id: Ie82d26a8866d005e481a67614b2756a03115d58a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2046541
Auto-Submit: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Matthew Wolenetz <wolenetz@chromium.org>
Reviewed-by: default avatarMatthew Wolenetz <wolenetz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#740519}
parent 6153a6f9
......@@ -33,6 +33,7 @@
#include <memory>
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "media/base/logging_override_if_enabled.h"
#include "third_party/blink/public/platform/web_media_source.h"
#include "third_party/blink/public/platform/web_source_buffer.h"
......@@ -47,7 +48,6 @@
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/network/mime/content_type.h"
......@@ -66,7 +66,7 @@ enum class MseExecutionContext {
kWindow = 0,
kDedicatedWorker = 1,
kSharedWorker = 2,
kMax = kSharedWorker
kMaxValue = kSharedWorker
};
} // namespace
......@@ -148,11 +148,7 @@ MediaSource::MediaSource(ExecutionContext* context)
else
CHECK(false) << "Invalid execution context for MSE usage";
}
DEFINE_THREAD_SAFE_STATIC_LOCAL(
EnumerationHistogram, mse_execution_context_histogram,
("Media.MSE.ExecutionContext",
static_cast<int>(MseExecutionContext::kMax) + 1));
mse_execution_context_histogram.Count(static_cast<int>(type));
base::UmaHistogramEnumeration("Media.MSE.ExecutionContext", type);
// TODO(wolenetz): Actually enable experimental usage of MediaSource from
// dedicated and shared worker contexts. See https://crbug.com/878133.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment