Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chromecast / media / cma / pipeline / media_component_device_client_impl.cc
blobe81ec0ad694478c5bf6276ef6fb880090c9c8e06
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/media_component_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"
12 namespace chromecast {
13 namespace media {
15 MediaComponentDeviceClientImpl::MediaComponentDeviceClientImpl(
16 const base::Closure& eos_cb)
17 : eos_cb_(eos_cb), task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
19 MediaComponentDeviceClientImpl::~MediaComponentDeviceClientImpl() {}
21 void MediaComponentDeviceClientImpl::OnEndOfStream() {
22 if (task_runner_->BelongsToCurrentThread()) {
23 if (!eos_cb_.is_null())
24 eos_cb_.Run();
25 } else {
26 task_runner_->PostTask(FROM_HERE, eos_cb_);
30 } // namespace media
31 } // namespace chromecast