Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: chromecast/media/cma/base/backend_client_callbacks.cc

Issue 1257013003: Load CMA backend from shared library (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test + android fixes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/base/backend_client_callbacks.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 MediaComponentDeviceClientImpl::MediaComponentDeviceClientImpl(
17 const base::Closure& eos_cb)
18 : eos_cb_(eos_cb), task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
19
20 MediaComponentDeviceClientImpl::~MediaComponentDeviceClientImpl() {}
21
22 void MediaComponentDeviceClientImpl::OnEndOfStream() {
23 if (!eos_cb_.is_null()) {
servolk 2015/07/27 21:25:47 Strictly speaking you shouldn't be accessing eos_c
halliwell 2015/07/28 02:19:35 Done.
24 if (task_runner_->BelongsToCurrentThread())
25 eos_cb_.Run();
26 else
27 task_runner_->PostTask(FROM_HERE, eos_cb_);
28 }
29 }
30
31 VideoPipelineDeviceClientImpl::VideoPipelineDeviceClientImpl(
32 const SizeChangeCB& size_change_cb)
33 : size_change_cb_(size_change_cb),
34 task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
35
36 VideoPipelineDeviceClientImpl::~VideoPipelineDeviceClientImpl() {}
37
38 void VideoPipelineDeviceClientImpl::OnNaturalSizeChanged(const Size& size) {
39 if (!size_change_cb_.is_null()) {
servolk 2015/07/27 21:25:47 ditto
halliwell 2015/07/28 02:19:35 Done.
40 if (task_runner_->BelongsToCurrentThread())
41 size_change_cb_.Run(size);
42 else
43 task_runner_->PostTask(FROM_HERE, base::Bind(size_change_cb_, size));
44 }
45 }
46
47 FrameStatusCBImpl::FrameStatusCBImpl(const CallbackType& cb)
48 : cb_(cb), task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
49
50 FrameStatusCBImpl::~FrameStatusCBImpl() {}
51
52 void FrameStatusCBImpl::Run(MediaComponentDevice::FrameStatus status) {
53 if (!cb_.is_null()) {
servolk 2015/07/27 21:25:47 ditto
halliwell 2015/07/28 02:19:35 Done.
54 if (task_runner_->BelongsToCurrentThread())
55 cb_.Run(status);
56 else
57 task_runner_->PostTask(FROM_HERE, base::Bind(cb_, status));
58 }
59 }
60
61 } // namespace media
62 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698