| 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 "content/renderer/gpu/frame_swap_message_queue.h" | 9 #include "content/renderer/gpu/frame_swap_message_queue.h" |
| 10 #include "gpu/command_buffer/client/gl_in_process_context.h" | 10 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 11 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 11 #include "ui/gl/android/surface_texture.h" | 12 #include "ui/gl/android/surface_texture.h" |
| 12 #include "ui/gl/gl_surface.h" | 13 #include "ui/gl/gl_surface.h" |
| 13 #include "ui/gl/gl_surface_stub.h" | 14 #include "ui/gl/gl_surface_stub.h" |
| 14 #include "webkit/common/gpu/context_provider_in_process.h" | 15 #include "webkit/common/gpu/context_provider_in_process.h" |
| 15 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 16 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 16 | 17 |
| 17 using webkit::gpu::ContextProviderWebContext; | 18 using webkit::gpu::ContextProviderWebContext; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 blink::WebGraphicsContext3D::Attributes GetDefaultAttribs() { | 24 blink::WebGraphicsContext3D::Attributes GetDefaultAttribs() { |
| 24 blink::WebGraphicsContext3D::Attributes attributes; | 25 blink::WebGraphicsContext3D::Attributes attributes; |
| 25 attributes.antialias = false; | 26 attributes.antialias = false; |
| 26 attributes.depth = false; | 27 attributes.depth = false; |
| 27 attributes.stencil = false; | 28 attributes.stencil = false; |
| 28 attributes.shareResources = true; | 29 attributes.shareResources = true; |
| 29 attributes.noAutomaticFlushes = true; | 30 attributes.noAutomaticFlushes = true; |
| 30 | 31 |
| 31 return attributes; | 32 return attributes; |
| 32 } | 33 } |
| 33 | 34 |
| 34 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; | 35 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; |
| 36 using webkit::gpu::WebGraphicsContext3DImpl; |
| 35 | 37 |
| 36 scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext( | 38 scoped_ptr<gpu::GLInProcessContext> CreateOffscreenContext( |
| 37 const blink::WebGraphicsContext3D::Attributes& attributes) { | 39 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 38 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 40 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
| 39 | 41 |
| 40 gpu::GLInProcessContextAttribs in_process_attribs; | 42 gpu::gles2::ContextCreationAttribHelper in_process_attribs; |
| 41 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 43 WebGraphicsContext3DImpl::ConvertAttributes( |
| 42 attributes, &in_process_attribs); | 44 attributes, &in_process_attribs); |
| 43 in_process_attribs.lose_context_when_out_of_memory = 1; | 45 in_process_attribs.lose_context_when_out_of_memory_ = true; |
| 46 in_process_attribs.bind_generates_resource_ = false; |
| 44 | 47 |
| 45 scoped_ptr<gpu::GLInProcessContext> context( | 48 scoped_ptr<gpu::GLInProcessContext> context( |
| 46 gpu::GLInProcessContext::Create(NULL /* service */, | 49 gpu::GLInProcessContext::Create(NULL /* service */, |
| 47 NULL /* surface */, | 50 NULL /* surface */, |
| 48 true /* is_offscreen */, | 51 true /* is_offscreen */, |
| 49 gfx::kNullAcceleratedWidget, | 52 gfx::kNullAcceleratedWidget, |
| 50 gfx::Size(1, 1), | 53 gfx::Size(1, 1), |
| 51 NULL /* share_context */, | 54 NULL /* share_context */, |
| 52 false /* share_resources */, | 55 false /* share_resources */, |
| 53 in_process_attribs, | 56 in_process_attribs, |
| 54 gpu_preference)); | 57 gpu_preference)); |
| 55 return context.Pass(); | 58 return context.Pass(); |
| 56 } | 59 } |
| 57 | 60 |
| 58 scoped_ptr<gpu::GLInProcessContext> CreateContext( | 61 scoped_ptr<gpu::GLInProcessContext> CreateContext( |
| 59 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, | 62 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
| 60 gpu::GLInProcessContext* share_context) { | 63 gpu::GLInProcessContext* share_context) { |
| 61 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 64 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
| 62 gpu::GLInProcessContextAttribs in_process_attribs; | 65 gpu::gles2::ContextCreationAttribHelper in_process_attribs; |
| 63 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 66 WebGraphicsContext3DImpl::ConvertAttributes( |
| 64 GetDefaultAttribs(), &in_process_attribs); | 67 GetDefaultAttribs(), &in_process_attribs); |
| 65 in_process_attribs.lose_context_when_out_of_memory = 1; | 68 in_process_attribs.lose_context_when_out_of_memory_ = true; |
| 69 in_process_attribs.bind_generates_resource_ = false; |
| 66 | 70 |
| 67 scoped_ptr<gpu::GLInProcessContext> context( | 71 scoped_ptr<gpu::GLInProcessContext> context( |
| 68 gpu::GLInProcessContext::Create(service, | 72 gpu::GLInProcessContext::Create(service, |
| 69 NULL /* surface */, | 73 NULL /* surface */, |
| 70 false /* is_offscreen */, | 74 false /* is_offscreen */, |
| 71 gfx::kNullAcceleratedWidget, | 75 gfx::kNullAcceleratedWidget, |
| 72 gfx::Size(1, 1), | 76 gfx::Size(1, 1), |
| 73 share_context, | 77 share_context, |
| 74 false /* share_resources */, | 78 false /* share_resources */, |
| 75 in_process_attribs, | 79 in_process_attribs, |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 DCHECK(!service_); | 266 DCHECK(!service_); |
| 263 service_ = service; | 267 service_ = service; |
| 264 } | 268 } |
| 265 | 269 |
| 266 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 270 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
| 267 bool record_full_document) { | 271 bool record_full_document) { |
| 268 record_full_layer_ = record_full_document; | 272 record_full_layer_ = record_full_document; |
| 269 } | 273 } |
| 270 | 274 |
| 271 } // namespace content | 275 } // namespace content |
| OLD | NEW |