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/renderer_blink_platform_impl.h" | 5 #include "content/renderer/renderer_blink_platform_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 std::string error_message( | 1006 std::string error_message( |
1007 "OffscreenContext Creation failed, Shared context is lost"); | 1007 "OffscreenContext Creation failed, Shared context is lost"); |
1008 gl_info->errorMessage = WebString::fromUTF8(error_message); | 1008 gl_info->errorMessage = WebString::fromUTF8(error_message); |
1009 return nullptr; | 1009 return nullptr; |
1010 } | 1010 } |
1011 share_context = share_provider_impl->context_provider(); | 1011 share_context = share_provider_impl->context_provider(); |
1012 } | 1012 } |
1013 | 1013 |
1014 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; | 1014 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; |
1015 | 1015 |
1016 // This is an offscreen context, which doesn't use the default frame buffer, | 1016 // This is an offscreen context. Generally it won't use the default |
1017 // so don't request any alpha, depth, stencil, antialiasing. | 1017 // frame buffer, in that case don't request any alpha, depth, stencil, |
| 1018 // antialiasing. But we do need those attributes for the "own |
| 1019 // offscreen surface" optimization which supports directly drawing |
| 1020 // to a custom surface backed frame buffer. |
1018 gpu::gles2::ContextCreationAttribHelper attributes; | 1021 gpu::gles2::ContextCreationAttribHelper attributes; |
1019 attributes.alpha_size = -1; | 1022 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; |
1020 attributes.depth_size = 0; | 1023 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; |
1021 attributes.stencil_size = 0; | 1024 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; |
1022 attributes.samples = 0; | 1025 attributes.samples = web_attributes.supportAntialias ? 4 : 0; |
1023 attributes.sample_buffers = 0; | 1026 attributes.sample_buffers = 0; |
1024 attributes.bind_generates_resource = false; | 1027 attributes.bind_generates_resource = false; |
1025 // Prefer discrete GPU for WebGL. | 1028 // Prefer discrete GPU for WebGL. |
1026 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1029 attributes.gpu_preference = gl::PreferDiscreteGpu; |
1027 | 1030 |
1028 attributes.fail_if_major_perf_caveat = | 1031 attributes.fail_if_major_perf_caveat = |
1029 web_attributes.failIfMajorPerformanceCaveat; | 1032 web_attributes.failIfMajorPerformanceCaveat; |
1030 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1033 DCHECK_GT(web_attributes.webGLVersion, 0u); |
1031 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1034 DCHECK_LE(web_attributes.webGLVersion, 2u); |
1032 if (web_attributes.webGLVersion == 2) | 1035 if (web_attributes.webGLVersion == 2) |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 //------------------------------------------------------------------------------ | 1294 //------------------------------------------------------------------------------ |
1292 void RendererBlinkPlatformImpl::requestPurgeMemory() { | 1295 void RendererBlinkPlatformImpl::requestPurgeMemory() { |
1293 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1296 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
1294 // ChildMemoryCoordinator isn't always available as it's only initialized | 1297 // ChildMemoryCoordinator isn't always available as it's only initialized |
1295 // when kMemoryCoordinatorV0 is enabled. | 1298 // when kMemoryCoordinatorV0 is enabled. |
1296 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1299 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
1297 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1300 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
1298 } | 1301 } |
1299 | 1302 |
1300 } // namespace content | 1303 } // namespace content |
OLD | NEW |