OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "chromecast/media/cma/pipeline/video_pipeline_device_client_impl.h" | |
6 | |
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" | |
12 | |
13 namespace chromecast { | |
14 namespace media { | |
15 | |
16 VideoPipelineDeviceClientImpl::VideoPipelineDeviceClientImpl( | |
17 const SizeChangeCB& size_change_cb) | |
18 : size_change_cb_(size_change_cb), | |
19 task_runner_(base::ThreadTaskRunnerHandle::Get()) {} | |
20 | |
21 VideoPipelineDeviceClientImpl::~VideoPipelineDeviceClientImpl() {} | |
22 | |
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)); | |
29 } | |
30 } | |
31 | |
32 } // namespace media | |
33 } // namespace chromecast | |
OLD | NEW |