Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromecast / media / cma / pipeline / video_pipeline_device_client_impl.cc
bloba604be36e20af3556156a9bade265f88fe0f6745
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chromecast/media/cma/pipeline/video_pipeline_device_client_impl.h"
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "chromecast/public/graphics_types.h"
13 namespace chromecast {
14 namespace media {
16 VideoPipelineDeviceClientImpl::VideoPipelineDeviceClientImpl(
17 const SizeChangeCB& size_change_cb)
18 : size_change_cb_(size_change_cb),
19 task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
21 VideoPipelineDeviceClientImpl::~VideoPipelineDeviceClientImpl() {}
23 void VideoPipelineDeviceClientImpl::OnNaturalSizeChanged(const Size& size) {
24 if (task_runner_->BelongsToCurrentThread()) {
25 if (!size_change_cb_.is_null())
26 size_change_cb_.Run(size);
27 } else {
28 task_runner_->PostTask(FROM_HERE, base::Bind(size_change_cb_, size));
32 } // namespace media
33 } // namespace chromecast