| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/render_thread_impl.h" | 5 #include "content/renderer/render_thread_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 enable_gpu_memory_buffer_video_frames, image_texture_targets, | 1485 enable_gpu_memory_buffer_video_frames, image_texture_targets, |
| 1486 enable_video_accelerator)); | 1486 enable_video_accelerator)); |
| 1487 return gpu_factories_.back(); | 1487 return gpu_factories_.back(); |
| 1488 } | 1488 } |
| 1489 return nullptr; | 1489 return nullptr; |
| 1490 } | 1490 } |
| 1491 | 1491 |
| 1492 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> | 1492 std::unique_ptr<WebGraphicsContext3DCommandBufferImpl> |
| 1493 RenderThreadImpl::CreateOffscreenContext3d() { | 1493 RenderThreadImpl::CreateOffscreenContext3d() { |
| 1494 // This is used to create a few different offscreen contexts: | 1494 // This is used to create a few different offscreen contexts: |
| 1495 // - The shared main thread context (offscreen) used by blink for canvas | 1495 // - The shared main thread context (offscreen) used by blink for canvas. |
| 1496 // - The worker context (offscreen) used for GPU raster and video decoding. | 1496 // - The worker context (offscreen) used for GPU raster and video decoding. |
| 1497 // This is for an offscreen context, so the default framebuffer doesn't need | 1497 // This is for an offscreen context, so the default framebuffer doesn't need |
| 1498 // alpha, depth, stencil, antialiasing. | 1498 // alpha, depth, stencil, antialiasing. |
| 1499 gpu::gles2::ContextCreationAttribHelper attributes; | 1499 gpu::gles2::ContextCreationAttribHelper attributes; |
| 1500 attributes.alpha_size = -1; | 1500 attributes.alpha_size = -1; |
| 1501 attributes.depth_size = 0; | 1501 attributes.depth_size = 0; |
| 1502 attributes.stencil_size = 0; | 1502 attributes.stencil_size = 0; |
| 1503 attributes.samples = 0; | 1503 attributes.samples = 0; |
| 1504 attributes.sample_buffers = 0; | 1504 attributes.sample_buffers = 0; |
| 1505 attributes.bind_generates_resource = false; | 1505 attributes.bind_generates_resource = false; |
| 1506 attributes.lose_context_when_out_of_memory = true; | 1506 attributes.lose_context_when_out_of_memory = true; |
| 1507 bool share_resources = true; | 1507 bool share_resources = true; |
| 1508 bool automatic_flushes = false; | 1508 bool automatic_flushes = false; |
| 1509 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( | 1509 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync( |
| 1510 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); | 1510 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| 1511 if (!gpu_channel_host) |
| 1512 return nullptr; |
| 1511 return base::WrapUnique( | 1513 return base::WrapUnique( |
| 1512 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 1514 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 1513 gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, | 1515 gpu_channel_host.get(), attributes, gfx::PreferIntegratedGpu, |
| 1514 share_resources, automatic_flushes, | 1516 share_resources, automatic_flushes, |
| 1515 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), | 1517 GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"), |
| 1516 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); | 1518 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); |
| 1517 } | 1519 } |
| 1518 | 1520 |
| 1519 scoped_refptr<cc_blink::ContextProviderWebContext> | 1521 scoped_refptr<cc_blink::ContextProviderWebContext> |
| 1520 RenderThreadImpl::SharedMainThreadContextProvider() { | 1522 RenderThreadImpl::SharedMainThreadContextProvider() { |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2145 } | 2147 } |
| 2146 | 2148 |
| 2147 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { | 2149 void RenderThreadImpl::PendingRenderFrameConnect::OnConnectionError() { |
| 2148 size_t erased = | 2150 size_t erased = |
| 2149 RenderThreadImpl::current()->pending_render_frame_connects_.erase( | 2151 RenderThreadImpl::current()->pending_render_frame_connects_.erase( |
| 2150 routing_id_); | 2152 routing_id_); |
| 2151 DCHECK_EQ(1u, erased); | 2153 DCHECK_EQ(1u, erased); |
| 2152 } | 2154 } |
| 2153 | 2155 |
| 2154 } // namespace content | 2156 } // namespace content |
| OLD | NEW |