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

Side by Side Diff: chromecast/renderer/media/video_pipeline_proxy.cc

Issue 1142513004: Chromecast: MessageLoopProxy cleanup --> SingleThreadTaskRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
« no previous file with comments | « chromecast/renderer/media/video_pipeline_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromecast/renderer/media/video_pipeline_proxy.h" 5 #include "chromecast/renderer/media/video_pipeline_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 status_cb_ = status_cb; 180 status_cb_ = status_cb;
181 } 181 }
182 182
183 void VideoPipelineProxyInternal::OnStateChanged( 183 void VideoPipelineProxyInternal::OnStateChanged(
184 ::media::PipelineStatus status) { 184 ::media::PipelineStatus status) {
185 DCHECK(thread_checker_.CalledOnValidThread()); 185 DCHECK(thread_checker_.CalledOnValidThread());
186 DCHECK(!status_cb_.is_null()); 186 DCHECK(!status_cb_.is_null());
187 base::ResetAndReturn(&status_cb_).Run(status); 187 base::ResetAndReturn(&status_cb_).Run(status);
188 } 188 }
189 189
190 190 // A macro runs current member function on |io_task_runner_| thread.
191 // A macro runs current member function on |io_message_loop_proxy_| thread. 191 #define FORWARD_ON_IO_THREAD(param_fn, ...) \
192 #define FORWARD_ON_IO_THREAD(param_fn, ...) \ 192 io_task_runner_->PostTask( \
193 io_message_loop_proxy_->PostTask( \ 193 FROM_HERE, base::Bind(&VideoPipelineProxyInternal::param_fn, \
194 FROM_HERE, \ 194 base::Unretained(proxy_.get()), ##__VA_ARGS__))
195 base::Bind(&VideoPipelineProxyInternal::param_fn, \
196 base::Unretained(proxy_.get()), ##__VA_ARGS__))
197 195
198 VideoPipelineProxy::VideoPipelineProxy( 196 VideoPipelineProxy::VideoPipelineProxy(
199 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy, 197 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
200 scoped_refptr<MediaChannelProxy> media_channel_proxy) 198 scoped_refptr<MediaChannelProxy> media_channel_proxy)
201 : io_message_loop_proxy_(io_message_loop_proxy), 199 : io_task_runner_(io_task_runner),
202 proxy_(new VideoPipelineProxyInternal(media_channel_proxy)), 200 proxy_(new VideoPipelineProxyInternal(media_channel_proxy)),
203 video_streamer_(new AvStreamerProxy()), 201 video_streamer_(new AvStreamerProxy()),
204 weak_factory_(this) { 202 weak_factory_(this) {
205 DCHECK(io_message_loop_proxy_.get()); 203 DCHECK(io_task_runner_.get());
206 weak_this_ = weak_factory_.GetWeakPtr(); 204 weak_this_ = weak_factory_.GetWeakPtr();
207 thread_checker_.DetachFromThread(); 205 thread_checker_.DetachFromThread();
208 } 206 }
209 207
210 VideoPipelineProxy::~VideoPipelineProxy() { 208 VideoPipelineProxy::~VideoPipelineProxy() {
211 DCHECK(thread_checker_.CalledOnValidThread()); 209 DCHECK(thread_checker_.CalledOnValidThread());
212 // Release the underlying object on the right thread. 210 // Release the underlying object on the right thread.
213 io_message_loop_proxy_->PostTask( 211 io_task_runner_->PostTask(
214 FROM_HERE, 212 FROM_HERE,
215 base::Bind(&VideoPipelineProxyInternal::Release, base::Passed(&proxy_))); 213 base::Bind(&VideoPipelineProxyInternal::Release, base::Passed(&proxy_)));
216 } 214 }
217 215
218 void VideoPipelineProxy::SetClient( 216 void VideoPipelineProxy::SetClient(
219 const VideoPipelineClient& video_client) { 217 const VideoPipelineClient& video_client) {
220 DCHECK(thread_checker_.CalledOnValidThread()); 218 DCHECK(thread_checker_.CalledOnValidThread());
221 base::Closure pipe_read_cb = 219 base::Closure pipe_read_cb =
222 ::media::BindToCurrentLoop( 220 ::media::BindToCurrentLoop(
223 base::Bind(&VideoPipelineProxy::OnPipeRead, weak_this_)); 221 base::Bind(&VideoPipelineProxy::OnPipeRead, weak_this_));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 288 }
291 289
292 void VideoPipelineProxy::OnPipeRead() { 290 void VideoPipelineProxy::OnPipeRead() {
293 DCHECK(thread_checker_.CalledOnValidThread()); 291 DCHECK(thread_checker_.CalledOnValidThread());
294 if (video_streamer_) 292 if (video_streamer_)
295 video_streamer_->OnFifoReadEvent(); 293 video_streamer_->OnFifoReadEvent();
296 } 294 }
297 295
298 } // namespace media 296 } // namespace media
299 } // namespace chromecast 297 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/renderer/media/video_pipeline_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698