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

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

Issue 344863005: Remove PostTask in StreamTextureProxyImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.";
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698