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 26 matching lines...) Expand all Loading... |
37 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, | 37 scoped_refptr<gpu::InProcessCommandBuffer::Service> service, |
38 gpu::GLInProcessContext* share_context) { | 38 gpu::GLInProcessContext* share_context) { |
39 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; | 39 const gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu; |
40 | 40 |
41 if (!surface) | 41 if (!surface) |
42 surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); | 42 surface = gfx::GLSurface::CreateOffscreenGLSurface(gfx::Size(1, 1)); |
43 | 43 |
44 gpu::GLInProcessContextAttribs in_process_attribs; | 44 gpu::GLInProcessContextAttribs in_process_attribs; |
45 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( | 45 WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes( |
46 GetDefaultAttribs(), &in_process_attribs); | 46 GetDefaultAttribs(), &in_process_attribs); |
47 in_process_attribs.lose_context_when_out_of_memory = 1; | |
48 scoped_ptr<gpu::GLInProcessContext> context( | 47 scoped_ptr<gpu::GLInProcessContext> context( |
49 gpu::GLInProcessContext::CreateWithSurface( | 48 gpu::GLInProcessContext::CreateWithSurface(surface, |
50 surface, service, share_context, in_process_attribs, gpu_preference)); | 49 service, |
| 50 share_context, |
| 51 in_process_attribs, |
| 52 gpu_preference)); |
51 return context.Pass(); | 53 return context.Pass(); |
52 } | 54 } |
53 | 55 |
54 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( | 56 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( |
55 scoped_ptr<gpu::GLInProcessContext> context) { | 57 scoped_ptr<gpu::GLInProcessContext> context) { |
56 if (!context.get()) | 58 if (!context.get()) |
57 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 59 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
58 | 60 |
59 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 61 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
60 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 62 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 return video_context_provider_; | 235 return video_context_provider_; |
234 } | 236 } |
235 | 237 |
236 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( | 238 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
237 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 239 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
238 DCHECK(!service_); | 240 DCHECK(!service_); |
239 service_ = service; | 241 service_ = service; |
240 } | 242 } |
241 | 243 |
242 } // namespace content | 244 } // namespace content |
OLD | NEW |