Commit 6c3194b5 authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Commit Bot

VideoDecodeStatsReporter: use Blink-provided foreground task runner

This is part of efforts to replace base::ThreadTaskRunnerHandle::Get()
with other appropriate task runners in the renderer.

Bug: 786332
Change-Id: I6310554d4cdbc93cd6420398ecfe9e668059dd99
Reviewed-on: https://chromium-review.googlesource.com/826605Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524305}
parent ec7624cd
......@@ -17,6 +17,7 @@ VideoDecodeStatsReporter::VideoDecodeStatsReporter(
mojom::VideoDecodeStatsRecorderPtr recorder_ptr,
GetPipelineStatsCB get_pipeline_stats_cb,
const VideoDecoderConfig& video_config,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::TickClock* tick_clock)
: kRecordingInterval(
base::TimeDelta::FromMilliseconds(kRecordingIntervalMs)),
......@@ -34,6 +35,7 @@ VideoDecodeStatsReporter::VideoDecodeStatsReporter(
recorder_ptr_.set_connection_error_handler(base::BindRepeating(
&VideoDecodeStatsReporter::OnIpcConnectionError, base::Unretained(this)));
stats_cb_timer_.SetTaskRunner(task_runner);
}
VideoDecodeStatsReporter::~VideoDecodeStatsReporter() = default;
......
......@@ -32,6 +32,7 @@ class MEDIA_BLINK_EXPORT VideoDecodeStatsReporter {
mojom::VideoDecodeStatsRecorderPtr recorder_ptr,
GetPipelineStatsCB get_pipeline_stats_cb,
const VideoDecoderConfig& video_config,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
base::TickClock* tick_clock = base::DefaultTickClock::GetInstance());
~VideoDecodeStatsReporter();
......
......@@ -170,7 +170,8 @@ class VideoDecodeStatsReporterTest : public ::testing::Test {
std::move(recorder_ptr),
base::Bind(&VideoDecodeStatsReporterTest::GetPipelineStatsCB,
base::Unretained(this)),
MakeDefaultVideoConfig(), clock_.get());
MakeDefaultVideoConfig(), base::ThreadTaskRunnerHandle::Get(),
clock_.get());
}
// Fast forward the task runner (and associated tick clock) by |milliseconds|.
......
......@@ -1524,7 +1524,8 @@ void WebMediaPlayerImpl::CreateVideoDecodeStatsReporter() {
std::move(recorder),
base::Bind(&WebMediaPlayerImpl::GetPipelineStatistics,
base::Unretained(this)),
pipeline_metadata_.video_decoder_config));
pipeline_metadata_.video_decoder_config,
frame_->GetTaskRunner(blink::TaskType::kUnthrottled)));
if (delegate_->IsFrameHidden())
video_decode_stats_reporter_->OnHidden();
......
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