| 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/browser/android/in_process/synchronous_compositor_factory_impl
.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
| 6 | 6 |
| 7 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 7 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "gpu/command_buffer/client/gl_in_process_context.h" | 9 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 10 #include "ui/gl/android/surface_texture.h" | 10 #include "ui/gl/android/surface_texture.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( | 79 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( |
| 80 scoped_ptr<gpu::GLInProcessContext> context) { | 80 scoped_ptr<gpu::GLInProcessContext> context) { |
| 81 if (!context.get()) | 81 if (!context.get()) |
| 82 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 82 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 83 | 83 |
| 84 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 84 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
| 85 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 85 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 86 context.Pass(), GetDefaultAttribs())); | 86 context.Pass(), GetDefaultAttribs())); |
| 87 } | 87 } |
| 88 | 88 |
| 89 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> |
| 90 WrapContextWithAttributes( |
| 91 scoped_ptr<gpu::GLInProcessContext> context, |
| 92 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 93 if (!context.get()) |
| 94 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 95 |
| 96 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
| 97 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 98 context.Pass(), attributes)); |
| 99 } |
| 100 |
| 89 class VideoContextProvider | 101 class VideoContextProvider |
| 90 : public StreamTextureFactorySynchronousImpl::ContextProvider { | 102 : public StreamTextureFactorySynchronousImpl::ContextProvider { |
| 91 public: | 103 public: |
| 92 VideoContextProvider( | 104 VideoContextProvider( |
| 93 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) | 105 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) |
| 94 : gl_in_process_context_(gl_in_process_context.get()) { | 106 : gl_in_process_context_(gl_in_process_context.get()) { |
| 95 | 107 |
| 96 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( | 108 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( |
| 97 WrapContext(gl_in_process_context.Pass()), | 109 WrapContext(gl_in_process_context.Pass()), |
| 98 "Video-Offscreen-main-thread"); | 110 "Video-Offscreen-main-thread"); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 base::Bind( | 208 base::Bind( |
| 197 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, | 209 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, |
| 198 base::Unretained(this)), | 210 base::Unretained(this)), |
| 199 frame_id)); | 211 frame_id)); |
| 200 return factory; | 212 return factory; |
| 201 } | 213 } |
| 202 | 214 |
| 203 blink::WebGraphicsContext3D* | 215 blink::WebGraphicsContext3D* |
| 204 SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D( | 216 SynchronousCompositorFactoryImpl::CreateOffscreenGraphicsContext3D( |
| 205 const blink::WebGraphicsContext3D::Attributes& attributes) { | 217 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 206 return WrapContext(CreateOffscreenContext(attributes)).release(); | 218 return WrapContextWithAttributes(CreateOffscreenContext(attributes), |
| 219 attributes).release(); |
| 207 } | 220 } |
| 208 | 221 |
| 209 void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() { | 222 void SynchronousCompositorFactoryImpl::CompositorInitializedHardwareDraw() { |
| 210 base::AutoLock lock(num_hardware_compositor_lock_); | 223 base::AutoLock lock(num_hardware_compositor_lock_); |
| 211 num_hardware_compositors_++; | 224 num_hardware_compositors_++; |
| 212 } | 225 } |
| 213 | 226 |
| 214 void SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw() { | 227 void SynchronousCompositorFactoryImpl::CompositorReleasedHardwareDraw() { |
| 215 base::AutoLock lock(num_hardware_compositor_lock_); | 228 base::AutoLock lock(num_hardware_compositor_lock_); |
| 216 DCHECK_GT(num_hardware_compositors_, 0u); | 229 DCHECK_GT(num_hardware_compositors_, 0u); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 244 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 257 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
| 245 DCHECK(!service_); | 258 DCHECK(!service_); |
| 246 service_ = service; | 259 service_ = service; |
| 247 } | 260 } |
| 248 | 261 |
| 249 void SynchronousCompositorFactoryImpl::DisableRecordFullLayer() { | 262 void SynchronousCompositorFactoryImpl::DisableRecordFullLayer() { |
| 250 record_full_layer_ = false; | 263 record_full_layer_ = false; |
| 251 } | 264 } |
| 252 | 265 |
| 253 } // namespace content | 266 } // namespace content |
| OLD | NEW |