| 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; |
| 47 scoped_ptr<gpu::GLInProcessContext> context( | 48 scoped_ptr<gpu::GLInProcessContext> context( |
| 48 gpu::GLInProcessContext::CreateWithSurface(surface, | 49 gpu::GLInProcessContext::CreateWithSurface( |
| 49 service, | 50 surface, service, share_context, in_process_attribs, gpu_preference)); |
| 50 share_context, | |
| 51 in_process_attribs, | |
| 52 gpu_preference)); | |
| 53 return context.Pass(); | 51 return context.Pass(); |
| 54 } | 52 } |
| 55 | 53 |
| 56 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( | 54 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> WrapContext( |
| 57 scoped_ptr<gpu::GLInProcessContext> context) { | 55 scoped_ptr<gpu::GLInProcessContext> context) { |
| 58 if (!context.get()) | 56 if (!context.get()) |
| 59 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 57 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 60 | 58 |
| 61 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 59 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
| 62 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 60 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return video_context_provider_; | 233 return video_context_provider_; |
| 236 } | 234 } |
| 237 | 235 |
| 238 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( | 236 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
| 239 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 237 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
| 240 DCHECK(!service_); | 238 DCHECK(!service_); |
| 241 service_ = service; | 239 service_ = service; |
| 242 } | 240 } |
| 243 | 241 |
| 244 } // namespace content | 242 } // namespace content |
| OLD | NEW |