Index: content/renderer/media/android/stream_texture_factory_synchronous_impl.cc |
diff --git a/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc b/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc |
index 75536cbacc92d1784a60e37d01792b1d5c19ecbc..f423afb604b446763419fffb62a37880fa196161 100644 |
--- a/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc |
+++ b/content/renderer/media/android/stream_texture_factory_synchronous_impl.cc |
@@ -39,7 +39,6 @@ class StreamTextureProxyImpl |
virtual void Release() OVERRIDE; |
private: |
- void BindOnCompositorThread(int stream_id); |
void OnFrameAvailable(); |
scoped_refptr<base::MessageLoopProxy> loop_; |
@@ -60,8 +59,6 @@ class StreamTextureProxyImpl |
StreamTextureProxyImpl::StreamTextureProxyImpl( |
StreamTextureFactorySynchronousImpl::ContextProvider* provider) |
: context_provider_(provider), has_updated_(false) { |
- DCHECK(RenderThreadImpl::current()); |
- loop_ = RenderThreadImpl::current()->compositor_message_loop_proxy(); |
std::fill(current_matrix_, current_matrix_ + 16, 0); |
} |
@@ -69,7 +66,7 @@ StreamTextureProxyImpl::~StreamTextureProxyImpl() {} |
void StreamTextureProxyImpl::Release() { |
SetClient(NULL); |
- if (!loop_->BelongsToCurrentThread()) |
+ if (loop_.get() && !loop_->BelongsToCurrentThread()) |
loop_->DeleteSoon(FROM_HERE, this); |
else |
delete this; |
@@ -81,19 +78,7 @@ void StreamTextureProxyImpl::SetClient(cc::VideoFrameProvider::Client* client) { |
} |
void StreamTextureProxyImpl::BindToCurrentThread(int stream_id) { |
- if (loop_->BelongsToCurrentThread()) { |
- BindOnCompositorThread(stream_id); |
- return; |
- } |
- |
- // Weakptr is only used on compositor thread loop, so this is safe. |
- loop_->PostTask(FROM_HERE, |
- base::Bind(&StreamTextureProxyImpl::BindOnCompositorThread, |
- AsWeakPtr(), |
- stream_id)); |
-} |
- |
-void StreamTextureProxyImpl::BindOnCompositorThread(int stream_id) { |
+ loop_ = base::MessageLoopProxy::current(); |
surface_texture_ = context_provider_->GetSurfaceTexture(stream_id); |
if (!surface_texture_) { |
LOG(ERROR) << "Failed to get SurfaceTexture for stream."; |