| 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 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 // This is an offscreen context. Generally it won't use the default | 980 // This is an offscreen context. Generally it won't use the default |
| 981 // frame buffer, in that case don't request any alpha, depth, stencil, | 981 // frame buffer, in that case don't request any alpha, depth, stencil, |
| 982 // antialiasing. But we do need those attributes for the "own | 982 // antialiasing. But we do need those attributes for the "own |
| 983 // offscreen surface" optimization which supports directly drawing | 983 // offscreen surface" optimization which supports directly drawing |
| 984 // to a custom surface backed frame buffer. | 984 // to a custom surface backed frame buffer. |
| 985 gpu::gles2::ContextCreationAttribHelper attributes; | 985 gpu::gles2::ContextCreationAttribHelper attributes; |
| 986 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; | 986 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; |
| 987 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; | 987 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; |
| 988 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; | 988 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; |
| 989 attributes.samples = web_attributes.supportAntialias ? 4 : 0; | 989 attributes.samples = web_attributes.supportAntialias ? 4 : 0; |
| 990 attributes.own_offscreen_surface = |
| 991 web_attributes.supportAlpha || web_attributes.supportDepth || |
| 992 web_attributes.supportStencil || web_attributes.supportAntialias; |
| 990 attributes.sample_buffers = 0; | 993 attributes.sample_buffers = 0; |
| 991 attributes.bind_generates_resource = false; | 994 attributes.bind_generates_resource = false; |
| 992 // Prefer discrete GPU for WebGL. | 995 // Prefer discrete GPU for WebGL. |
| 993 attributes.gpu_preference = gl::PreferDiscreteGpu; | 996 attributes.gpu_preference = gl::PreferDiscreteGpu; |
| 994 | 997 |
| 995 attributes.fail_if_major_perf_caveat = | 998 attributes.fail_if_major_perf_caveat = |
| 996 web_attributes.failIfMajorPerformanceCaveat; | 999 web_attributes.failIfMajorPerformanceCaveat; |
| 997 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1000 DCHECK_GT(web_attributes.webGLVersion, 0u); |
| 998 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1001 DCHECK_LE(web_attributes.webGLVersion, 2u); |
| 999 if (web_attributes.webGLVersion == 2) | 1002 if (web_attributes.webGLVersion == 2) |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 //------------------------------------------------------------------------------ | 1259 //------------------------------------------------------------------------------ |
| 1257 void RendererBlinkPlatformImpl::requestPurgeMemory() { | 1260 void RendererBlinkPlatformImpl::requestPurgeMemory() { |
| 1258 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but | 1261 // TODO(tasak|bashi): We should use ChildMemoryCoordinator here, but |
| 1259 // ChildMemoryCoordinator isn't always available as it's only initialized | 1262 // ChildMemoryCoordinator isn't always available as it's only initialized |
| 1260 // when kMemoryCoordinatorV0 is enabled. | 1263 // when kMemoryCoordinatorV0 is enabled. |
| 1261 // Use ChildMemoryCoordinator when memory coordinator is always enabled. | 1264 // Use ChildMemoryCoordinator when memory coordinator is always enabled. |
| 1262 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); | 1265 base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); |
| 1263 } | 1266 } |
| 1264 | 1267 |
| 1265 } // namespace content | 1268 } // namespace content |
| OLD | NEW |