Chromium Code Reviews| Index: content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc |
| diff --git a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc |
| index 1027923286665f348b88feec5076fa528afe7e68..a9122639ce4d99cfc027c567dec29fd5476c3d41 100644 |
| --- a/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc |
| +++ b/content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc |
| @@ -124,11 +124,14 @@ StreamTextureFactorySynchronousImpl::StreamTextureFactorySynchronousImpl( |
| StreamTextureFactorySynchronousImpl::~StreamTextureFactorySynchronousImpl() {} |
| StreamTextureProxy* StreamTextureFactorySynchronousImpl::CreateProxy() { |
| + if (!context_provider_) |
| + return NULL; |
| return new StreamTextureProxyImpl(context_provider_); |
| } |
| void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, |
| int player_id) { |
| + DCHECK(context_provider_); |
| scoped_refptr<gfx::SurfaceTexture> surface_texture = |
| context_provider_->GetSurfaceTexture(stream_id); |
| if (surface_texture) { |
| @@ -145,9 +148,11 @@ unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( |
| unsigned* texture_id, |
| gpu::Mailbox* texture_mailbox, |
| unsigned* texture_mailbox_sync_point) { |
| - WebKit::WebGraphicsContext3D* context = context_provider_->Context3d(); |
| + WebKit::WebGraphicsContext3D* context = NULL; |
| unsigned stream_id = 0; |
| - if (context->makeContextCurrent()) { |
| + if (context_provider_ && |
|
no sievers
2013/09/06 01:50:34
Can we avoid allowing context_provider_ == NULL in
boliu
2013/09/06 02:59:26
Done.
|
| + (context = context_provider_->Context3d()) && |
| + context->makeContextCurrent()) { |
| *texture_id = context->createTexture(); |
| stream_id = context->createStreamTextureCHROMIUM(*texture_id); |
| @@ -163,6 +168,7 @@ unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( |
| void StreamTextureFactorySynchronousImpl::DestroyStreamTexture( |
| unsigned texture_id) { |
| + DCHECK(context_provider_); |
| WebKit::WebGraphicsContext3D* context = context_provider_->Context3d(); |
| if (context->makeContextCurrent()) { |
| context->destroyStreamTextureCHROMIUM(texture_id); |