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

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

Issue 870693002: Require Renderer::Initialize() to return a status code via callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments. Created 5 years, 11 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 | « media/mojo/services/mojo_renderer_impl.h ('k') | media/mojo/services/mojo_renderer_service.h » ('j') | 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 "media/mojo/services/mojo_renderer_impl.h" 5 #include "media/mojo/services/mojo_renderer_impl.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/location.h" 9 #include "base/location.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 17 matching lines...) Expand all
28 28
29 MojoRendererImpl::~MojoRendererImpl() { 29 MojoRendererImpl::~MojoRendererImpl() {
30 DVLOG(1) << __FUNCTION__; 30 DVLOG(1) << __FUNCTION__;
31 DCHECK(task_runner_->BelongsToCurrentThread()); 31 DCHECK(task_runner_->BelongsToCurrentThread());
32 // Connection to |remote_media_renderer_| will error-out here. 32 // Connection to |remote_media_renderer_| will error-out here.
33 } 33 }
34 34
35 // TODO(xhwang): Support |paint_cb| if needed. 35 // TODO(xhwang): Support |paint_cb| if needed.
36 void MojoRendererImpl::Initialize( 36 void MojoRendererImpl::Initialize(
37 DemuxerStreamProvider* demuxer_stream_provider, 37 DemuxerStreamProvider* demuxer_stream_provider,
38 const base::Closure& init_cb, 38 const PipelineStatusCB& init_cb,
39 const StatisticsCB& statistics_cb, 39 const StatisticsCB& statistics_cb,
40 const BufferingStateCB& buffering_state_cb, 40 const BufferingStateCB& buffering_state_cb,
41 const PaintCB& /* paint_cb */, 41 const PaintCB& /* paint_cb */,
42 const base::Closure& ended_cb, 42 const base::Closure& ended_cb,
43 const PipelineStatusCB& error_cb) { 43 const PipelineStatusCB& error_cb) {
44 DVLOG(1) << __FUNCTION__; 44 DVLOG(1) << __FUNCTION__;
45 DCHECK(task_runner_->BelongsToCurrentThread()); 45 DCHECK(task_runner_->BelongsToCurrentThread());
46 DCHECK(demuxer_stream_provider); 46 DCHECK(demuxer_stream_provider);
47 47
48 // Bind the mojo InterfacePtr to the message pipe on the 48 // Bind the mojo InterfacePtr to the message pipe on the
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 FROM_HERE, 195 FROM_HERE,
196 base::Bind(&MojoRendererImpl::OnError, weak_factory_.GetWeakPtr())); 196 base::Bind(&MojoRendererImpl::OnError, weak_factory_.GetWeakPtr()));
197 return; 197 return;
198 } 198 }
199 199
200 // TODO(tim): Should we plumb error code from remote renderer? 200 // TODO(tim): Should we plumb error code from remote renderer?
201 // http://crbug.com/410451. 201 // http://crbug.com/410451.
202 if (init_cb_.is_null()) // We have initialized already. 202 if (init_cb_.is_null()) // We have initialized already.
203 error_cb_.Run(PIPELINE_ERROR_DECODE); 203 error_cb_.Run(PIPELINE_ERROR_DECODE);
204 else 204 else
205 error_cb_.Run(PIPELINE_ERROR_COULD_NOT_RENDER); 205 init_cb_.Run(PIPELINE_ERROR_COULD_NOT_RENDER);
206 } 206 }
207 207
208 void MojoRendererImpl::OnInitialized() { 208 void MojoRendererImpl::OnInitialized() {
209 DVLOG(1) << __FUNCTION__; 209 DVLOG(1) << __FUNCTION__;
210 DCHECK(task_runner_->BelongsToCurrentThread()); 210 DCHECK(task_runner_->BelongsToCurrentThread());
211 DCHECK(!init_cb_.is_null()); 211 if (!init_cb_.is_null())
212 212 base::ResetAndReturn(&init_cb_).Run(PIPELINE_OK);
213 base::ResetAndReturn(&init_cb_).Run();
214 } 213 }
215 214
216 } // namespace media 215 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_renderer_impl.h ('k') | media/mojo/services/mojo_renderer_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698