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/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/process/process_handle.h" | 14 #include "base/process/process_handle.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "cc/output/context_provider.h" | 17 #include "cc/output/context_provider.h" |
18 #include "content/common/android/surface_texture_peer.h" | |
19 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
20 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 #include "gpu/ipc/common/surface_texture_peer.h" |
21 #include "ui/gl/android/surface_texture.h" | 21 #include "ui/gl/android/surface_texture.h" |
22 | 22 |
23 using gpu::gles2::GLES2Interface; | 23 using gpu::gles2::GLES2Interface; |
24 | 24 |
25 namespace content { | 25 namespace content { |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 class StreamTextureProxyImpl | 29 class StreamTextureProxyImpl |
30 : public StreamTextureProxy, | 30 : public StreamTextureProxy, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return new StreamTextureProxyImpl(context_provider_.get()); | 176 return new StreamTextureProxyImpl(context_provider_.get()); |
177 } | 177 } |
178 | 178 |
179 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32_t stream_id, | 179 void StreamTextureFactorySynchronousImpl::EstablishPeer(int32_t stream_id, |
180 int player_id, | 180 int player_id, |
181 int frame_id) { | 181 int frame_id) { |
182 DCHECK(context_provider_.get()); | 182 DCHECK(context_provider_.get()); |
183 scoped_refptr<gfx::SurfaceTexture> surface_texture = | 183 scoped_refptr<gfx::SurfaceTexture> surface_texture = |
184 context_provider_->GetSurfaceTexture(stream_id); | 184 context_provider_->GetSurfaceTexture(stream_id); |
185 if (surface_texture.get()) { | 185 if (surface_texture.get()) { |
186 SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( | 186 gpu::SurfaceTexturePeer::GetInstance()->EstablishSurfaceTexturePeer( |
187 base::GetCurrentProcessHandle(), | 187 base::GetCurrentProcessHandle(), surface_texture, frame_id, player_id); |
188 surface_texture, | |
189 frame_id, | |
190 player_id); | |
191 } | 188 } |
192 } | 189 } |
193 | 190 |
194 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( | 191 unsigned StreamTextureFactorySynchronousImpl::CreateStreamTexture( |
195 unsigned texture_target, | 192 unsigned texture_target, |
196 unsigned* texture_id, | 193 unsigned* texture_id, |
197 gpu::Mailbox* texture_mailbox) { | 194 gpu::Mailbox* texture_mailbox) { |
198 DCHECK(context_provider_.get()); | 195 DCHECK(context_provider_.get()); |
199 unsigned stream_id = 0; | 196 unsigned stream_id = 0; |
200 GLES2Interface* gl = context_provider_->ContextGL(); | 197 GLES2Interface* gl = context_provider_->ContextGL(); |
(...skipping 25 matching lines...) Expand all Loading... |
226 | 223 |
227 void StreamTextureFactorySynchronousImpl::RemoveObserver( | 224 void StreamTextureFactorySynchronousImpl::RemoveObserver( |
228 StreamTextureFactoryContextObserver* obs) { | 225 StreamTextureFactoryContextObserver* obs) { |
229 DCHECK(observers_.find(obs) != observers_.end()); | 226 DCHECK(observers_.find(obs) != observers_.end()); |
230 observers_.erase(obs); | 227 observers_.erase(obs); |
231 if (context_provider_.get()) | 228 if (context_provider_.get()) |
232 context_provider_->RemoveObserver(obs); | 229 context_provider_->RemoveObserver(obs); |
233 } | 230 } |
234 | 231 |
235 } // namespace content | 232 } // namespace content |
OLD | NEW |