Skip to content

Commit

Permalink
VideoDecodeStatsReporter: use Blink-provided foreground task runner
Browse files Browse the repository at this point in the history
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/826605
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524305}
  • Loading branch information
Hajime Hoshi authored and Commit Bot committed Dec 15, 2017
1 parent ec7624c commit 6c3194b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions media/blink/video_decode_stats_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions media/blink/video_decode_stats_reporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 2 additions & 1 deletion media/blink/video_decode_stats_reporter_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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|.
Expand Down
3 changes: 2 additions & 1 deletion media/blink/webmediaplayer_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6c3194b

Please sign in to comment.