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

Unified Diff: content/renderer/media/android/stream_texture_factory_android_synchronous_impl.cc

Issue 23618031: [Android WebView] Clean up global GL resource pt.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address joth's comments Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
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);
« no previous file with comments | « content/browser/android/in_process/synchronous_compositor_impl.cc ('k') | content/renderer/render_view_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698