| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/android/stream_texture_factory_synchronous_impl
.h" | 5 #include "content/renderer/media/android/stream_texture_factory_synchronous_impl
.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
| 14 #include "base/process/process.h" | 14 #include "base/process/process_handle.h" |
| 15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "cc/output/context_provider.h" | 16 #include "cc/output/context_provider.h" |
| 17 #include "content/common/android/surface_texture_peer.h" | 17 #include "content/common/android/surface_texture_peer.h" |
| 18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 19 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 #include "ui/gl/android/surface_texture.h" | 20 #include "ui/gl/android/surface_texture.h" |
| 21 | 21 |
| 22 using gpu::gles2::GLES2Interface; | 22 using gpu::gles2::GLES2Interface; |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return new StreamTextureProxyImpl(context_provider_.get()); | 178 return new StreamTextureProxyImpl(context_provider_.get()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, | 181 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32 stream_id, |
| 182 int player_id) { | 182 int player_id) { |
| 183 DCHECK(context_provider_.get()); | 183 DCHECK(context_provider_.get()); |
| 184 scoped_refptr<gfx::SurfaceTexture> surface_texture = | 184 scoped_refptr<gfx::SurfaceTexture> surface_texture = |
| 185 context_provider_->GetSurfaceTexture(stream_id); | 185 context_provider_->GetSurfaceTexture(stream_id); |
| 186 if (surface_texture.get()) { | 186 if (surface_texture.get()) { |
| 187 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( | 187 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( |
| 188 base::Process::Current().handle(), | 188 base::GetCurrentProcessHandle(), |
| 189 surface_texture, | 189 surface_texture, |
| 190 frame_id_, | 190 frame_id_, |
| 191 player_id); | 191 player_id); |
| 192 } | 192 } |
| 193 } | 193 } |
| 194 | 194 |
| 195 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( | 195 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( |
| 196 unsigned texture_target, | 196 unsigned texture_target, |
| 197 unsigned* texture_id, | 197 unsigned* texture_id, |
| 198 gpu::Mailbox* texture_mailbox) { | 198 gpu::Mailbox* texture_mailbox) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 227 | 227 |
| 228 void StreamTextureFactorySynchronousImpl::RemoveObserver( | 228 void StreamTextureFactorySynchronousImpl::RemoveObserver( |
| 229 StreamTextureFactoryContextObserver* obs) { | 229 StreamTextureFactoryContextObserver* obs) { |
| 230 DCHECK_EQ(observer_, obs); | 230 DCHECK_EQ(observer_, obs); |
| 231 observer_ = NULL; | 231 observer_ = NULL; |
| 232 if (context_provider_.get()) | 232 if (context_provider_.get()) |
| 233 context_provider_->RemoveObserver(obs); | 233 context_provider_->RemoveObserver(obs); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace content | 236 } // namespace content |
| OLD | NEW |