| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/stream_texture_factory_impl_android.h" | 5 #include "content/renderer/media/stream_texture_factory_impl_android.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 StreamTextureProxyImpl::StreamTextureProxyImpl( | 50 StreamTextureProxyImpl::StreamTextureProxyImpl( |
| 51 content::StreamTextureHost* host) | 51 content::StreamTextureHost* host) |
| 52 : host_(host), | 52 : host_(host), |
| 53 client_(NULL) { | 53 client_(NULL) { |
| 54 DCHECK(host); | 54 DCHECK(host); |
| 55 host->SetListener(this); | 55 host->SetListener(this); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void StreamTextureProxyImpl::Release() { | 58 void StreamTextureProxyImpl::Release() { |
| 59 SetClient(NULL); | 59 SetClient(NULL); |
| 60 if (loop_ && loop_ != base::MessageLoopProxy::current()) | 60 if (loop_.get() && loop_.get() != base::MessageLoopProxy::current()) |
| 61 loop_->DeleteSoon(FROM_HERE, this); | 61 loop_->DeleteSoon(FROM_HERE, this); |
| 62 else | 62 else |
| 63 delete this; | 63 delete this; |
| 64 } | 64 } |
| 65 | 65 |
| 66 void StreamTextureProxyImpl::SetClient(cc::VideoFrameProvider::Client* client) { | 66 void StreamTextureProxyImpl::SetClient(cc::VideoFrameProvider::Client* client) { |
| 67 base::AutoLock lock(client_lock_); | 67 base::AutoLock lock(client_lock_); |
| 68 client_ = client; | 68 client_ = client; |
| 69 } | 69 } |
| 70 | 70 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { | 129 void StreamTextureFactoryImpl::DestroyStreamTexture(unsigned texture_id) { |
| 130 if (context_->makeContextCurrent()) { | 130 if (context_->makeContextCurrent()) { |
| 131 context_->destroyStreamTextureCHROMIUM(texture_id); | 131 context_->destroyStreamTextureCHROMIUM(texture_id); |
| 132 context_->deleteTexture(texture_id); | 132 context_->deleteTexture(texture_id); |
| 133 context_->flush(); | 133 context_->flush(); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 | 136 |
| 137 } // namespace content | 137 } // namespace content |
| OLD | NEW |