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; |
44 | 46 |
45 scoped_ptr<gpu::GLInProcessContext> context( | 47 scoped_ptr<gpu::GLInProcessContext> context( |
46 gpu::GLInProcessContext::Create(NULL /* service */, | 48 gpu::GLInProcessContext::Create(NULL /* service */, |
47 NULL /* surface */, | 49 NULL /* surface */, |
48 true /* is_offscreen */, | 50 true /* is_offscreen */, |
49 gfx::kNullAcceleratedWidget, | 51 gfx::kNullAcceleratedWidget, |
50 gfx::Size(1, 1), | 52 gfx::Size(1, 1), |
51 NULL /* share_context */, | 53 NULL /* share_context */, |
52 false /* share_resources */, | 54 false /* share_resources */, |
53 in_process_attribs, | 55 in_process_attribs, |
54 gpu_preference)); | 56 gpu_preference)); |
55 return context.Pass(); | 57 return context.Pass(); |
56 } | 58 } |
57 | 59 |
58 scoped_ptr<gpu::GLInProcessContext> CreateContext( | 60 scoped_ptr<gpu::GLInProcessContext> CreateContext( |
59 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, | 61 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
60 gpu::GLInProcessContext* share_context) { | 62 gpu::GLInProcessContext* share_context) { |
61 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 63 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
62 gpu::GLInProcessContextAttribs in_process_attribs; | 64 gpu::gles2::ContextCreationAttribHelper in_process_attribs; |
63 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 65 WebGraphicsContext3DImpl::ConvertAttributes( |
64 GetDefaultAttribs(), &in_process_attribs); | 66 GetDefaultAttribs(), &in_process_attribs); |
65 in_process_attribs.lose_context_when_out_of_memory = 1; | 67 in_process_attribs.lose_context_when_out_of_memory = true; |
66 | 68 |
67 scoped_ptr<gpu::GLInProcessContext> context( | 69 scoped_ptr<gpu::GLInProcessContext> context( |
68 gpu::GLInProcessContext::Create(service, | 70 gpu::GLInProcessContext::Create(service, |
69 NULL /* surface */, | 71 NULL /* surface */, |
70 false /* is_offscreen */, | 72 false /* is_offscreen */, |
71 gfx::kNullAcceleratedWidget, | 73 gfx::kNullAcceleratedWidget, |
72 gfx::Size(1, 1), | 74 gfx::Size(1, 1), |
73 share_context, | 75 share_context, |
74 false /* share_resources */, | 76 false /* share_resources */, |
75 in_process_attribs, | 77 in_process_attribs, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 DCHECK(!service_); | 264 DCHECK(!service_); |
263 service_ = service; | 265 service_ = service; |
264 } | 266 } |
265 | 267 |
266 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( | 268 void SynchronousCompositorFactoryImpl::SetRecordFullDocument( |
267 bool record_full_document) { | 269 bool record_full_document) { |
268 record_full_layer_ = record_full_document; | 270 record_full_layer_ = record_full_document; |
269 } | 271 } |
270 | 272 |
271 } // namespace content | 273 } // namespace content |
OLD | NEW |