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

Side by Side Diff: media/mojo/services/mojo_renderer_impl.cc

Issue 1821153004: media: Use PassInterface() in mojo media classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 "media/mojo/services/mojo_renderer_impl.h" 5 #include "media/mojo/services/mojo_renderer_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "media/base/demuxer_stream_provider.h" 13 #include "media/base/demuxer_stream_provider.h"
14 #include "media/mojo/services/mojo_demuxer_stream_impl.h" 14 #include "media/mojo/services/mojo_demuxer_stream_impl.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 MojoRendererImpl::MojoRendererImpl( 18 MojoRendererImpl::MojoRendererImpl(
19 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 19 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
20 interfaces::RendererPtr remote_renderer) 20 interfaces::RendererPtr remote_renderer)
21 : task_runner_(task_runner), 21 : task_runner_(task_runner),
22 remote_renderer_(std::move(remote_renderer)), 22 remote_renderer_info_(remote_renderer.PassInterface()),
23 binding_(this) { 23 binding_(this) {
24 DVLOG(1) << __FUNCTION__; 24 DVLOG(1) << __FUNCTION__;
25 } 25 }
26 26
27 MojoRendererImpl::~MojoRendererImpl() { 27 MojoRendererImpl::~MojoRendererImpl() {
28 DVLOG(1) << __FUNCTION__; 28 DVLOG(1) << __FUNCTION__;
29 DCHECK(task_runner_->BelongsToCurrentThread()); 29 DCHECK(task_runner_->BelongsToCurrentThread());
30 } 30 }
31 31
32 // TODO(xhwang): Support |waiting_for_decryption_key_cb| and |statictics_cb|. 32 // TODO(xhwang): Support |waiting_for_decryption_key_cb| and |statictics_cb|.
33 // See http://crbug.com/585287 33 // See http://crbug.com/585287
34 void MojoRendererImpl::Initialize( 34 void MojoRendererImpl::Initialize(
35 DemuxerStreamProvider* demuxer_stream_provider, 35 DemuxerStreamProvider* demuxer_stream_provider,
36 const PipelineStatusCB& init_cb, 36 const PipelineStatusCB& init_cb,
37 const StatisticsCB& /* statistics_cb */, 37 const StatisticsCB& /* statistics_cb */,
38 const BufferingStateCB& buffering_state_cb, 38 const BufferingStateCB& buffering_state_cb,
39 const base::Closure& ended_cb, 39 const base::Closure& ended_cb,
40 const PipelineStatusCB& error_cb, 40 const PipelineStatusCB& error_cb,
41 const base::Closure& /* waiting_for_decryption_key_cb */) { 41 const base::Closure& /* waiting_for_decryption_key_cb */) {
42 DVLOG(1) << __FUNCTION__; 42 DVLOG(1) << __FUNCTION__;
43 DCHECK(task_runner_->BelongsToCurrentThread()); 43 DCHECK(task_runner_->BelongsToCurrentThread());
44 DCHECK(demuxer_stream_provider); 44 DCHECK(demuxer_stream_provider);
45 45
46 // Bind |remote_renderer_| to the |task_runner_|.
47 remote_renderer_.Bind(std::move(remote_renderer_info_));
48
46 // If connection error has happened, fail immediately. 49 // If connection error has happened, fail immediately.
47 if (remote_renderer_.encountered_error()) { 50 if (remote_renderer_.encountered_error()) {
48 task_runner_->PostTask( 51 task_runner_->PostTask(
49 FROM_HERE, base::Bind(init_cb, PIPELINE_ERROR_INITIALIZATION_FAILED)); 52 FROM_HERE, base::Bind(init_cb, PIPELINE_ERROR_INITIALIZATION_FAILED));
50 return; 53 return;
51 } 54 }
52 55
53 // Otherwise, set an error handler to catch the connection error. 56 // Otherwise, set an error handler to catch the connection error.
54 // Using base::Unretained(this) is safe because |this| owns 57 // Using base::Unretained(this) is safe because |this| owns
55 // |remote_renderer_|, and the error handler can't be invoked once 58 // |remote_renderer_|, and the error handler can't be invoked once
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 void MojoRendererImpl::OnInitialized(bool success) { 201 void MojoRendererImpl::OnInitialized(bool success) {
199 DVLOG(1) << __FUNCTION__; 202 DVLOG(1) << __FUNCTION__;
200 DCHECK(task_runner_->BelongsToCurrentThread()); 203 DCHECK(task_runner_->BelongsToCurrentThread());
201 DCHECK(!init_cb_.is_null()); 204 DCHECK(!init_cb_.is_null());
202 205
203 base::ResetAndReturn(&init_cb_) 206 base::ResetAndReturn(&init_cb_)
204 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED); 207 .Run(success ? PIPELINE_OK : PIPELINE_ERROR_INITIALIZATION_FAILED);
205 } 208 }
206 209
207 } // namespace media 210 } // namespace media
OLDNEW
« media/mojo/services/mojo_renderer_impl.h ('K') | « media/mojo/services/mojo_renderer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698