| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
| 9 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" | 9 #include "content/browser/android/in_process/synchronous_compositor_external_beg
in_frame_source.h" |
| 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 10 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 76 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 77 context.Pass(), attributes)); | 77 context.Pass(), attributes)); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 class SynchronousCompositorFactoryImpl::VideoContextProvider | 82 class SynchronousCompositorFactoryImpl::VideoContextProvider |
| 83 : public StreamTextureFactorySynchronousImpl::ContextProvider { | 83 : public StreamTextureFactorySynchronousImpl::ContextProvider { |
| 84 public: | 84 public: |
| 85 VideoContextProvider( | 85 VideoContextProvider( |
| 86 scoped_ptr<gpu::GLInProcessContext> gl_in_process_context) | 86 scoped_refptr<cc::ContextProvider> context_provider, |
| 87 : gl_in_process_context_(gl_in_process_context.get()) { | 87 gpu::GLInProcessContext* gl_in_process_context) |
| 88 context_provider_ = webkit::gpu::ContextProviderInProcess::Create( | 88 : context_provider_(context_provider), |
| 89 WrapContext(gl_in_process_context.Pass(), GetDefaultAttribs()), | 89 gl_in_process_context_(gl_in_process_context) { |
| 90 "Video-Offscreen-main-thread"); | |
| 91 context_provider_->BindToCurrentThread(); | 90 context_provider_->BindToCurrentThread(); |
| 92 } | 91 } |
| 93 | 92 |
| 94 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( | 93 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture( |
| 95 uint32 stream_id) override { | 94 uint32 stream_id) override { |
| 96 return gl_in_process_context_->GetSurfaceTexture(stream_id); | 95 return gl_in_process_context_->GetSurfaceTexture(stream_id); |
| 97 } | 96 } |
| 98 | 97 |
| 99 gpu::gles2::GLES2Interface* ContextGL() override { | 98 gpu::gles2::GLES2Interface* ContextGL() override { |
| 100 return context_provider_->ContextGL(); | 99 return context_provider_->ContextGL(); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); | 254 scoped_refptr<StreamTextureFactorySynchronousImpl::ContextProvider>(); |
| 256 } | 255 } |
| 257 | 256 |
| 258 if (!video_context_provider_.get()) { | 257 if (!video_context_provider_.get()) { |
| 259 DCHECK(service_.get()); | 258 DCHECK(service_.get()); |
| 260 | 259 |
| 261 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); | 260 blink::WebGraphicsContext3D::Attributes attributes = GetDefaultAttribs(); |
| 262 attributes.shareResources = false; | 261 attributes.shareResources = false; |
| 263 // This needs to run in on-screen |service_| context due to SurfaceTexture | 262 // This needs to run in on-screen |service_| context due to SurfaceTexture |
| 264 // limitations. | 263 // limitations. |
| 265 video_context_provider_ = new VideoContextProvider(CreateContextHolder( | 264 scoped_ptr<gpu::GLInProcessContext> context = |
| 266 attributes, service_, gpu::GLInProcessContextSharedMemoryLimits(), | 265 CreateContextHolder(attributes, service_, |
| 267 false)); | 266 gpu::GLInProcessContextSharedMemoryLimits(), false); |
| 267 gpu::GLInProcessContext* context_ptr = context.get(); |
| 268 video_context_provider_ = |
| 269 new VideoContextProvider(webkit::gpu::ContextProviderInProcess::Create( |
| 270 WrapContext(context.Pass(), attributes), |
| 271 "Video-Offscreen-main-thread"), |
| 272 context_ptr); |
| 268 } | 273 } |
| 269 return video_context_provider_; | 274 return video_context_provider_; |
| 270 } | 275 } |
| 271 | 276 |
| 272 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( | 277 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
| 273 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 278 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
| 274 DCHECK(!service_.get()); | 279 DCHECK(!service_.get()); |
| 275 service_ = service; | 280 service_ = service; |
| 276 } | 281 } |
| 277 | 282 |
| 278 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 283 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
| 279 bool record_full_document) { | 284 bool record_full_document) { |
| 280 record_full_layer_ = record_full_document; | 285 record_full_layer_ = record_full_document; |
| 281 } | 286 } |
| 282 | 287 |
| 283 } // namespace content | 288 } // namespace content |
| OLD | NEW |