| 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 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 return nullptr; | 1013 return nullptr; |
| 1014 } | 1014 } |
| 1015 share_context = share_provider_impl->context_provider(); | 1015 share_context = share_provider_impl->context_provider(); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; | 1018 bool is_software_rendering = gpu_channel_host->gpu_info().software_rendering; |
| 1019 | 1019 |
| 1020 // This is an offscreen context, which doesn't use the default frame buffer, | 1020 // This is an offscreen context, which doesn't use the default frame buffer, |
| 1021 // so don't request any alpha, depth, stencil, antialiasing. | 1021 // so don't request any alpha, depth, stencil, antialiasing. |
| 1022 gpu::gles2::ContextCreationAttribHelper attributes; | 1022 gpu::gles2::ContextCreationAttribHelper attributes; |
| 1023 | 1023 attributes.alpha_size = -1; |
| 1024 if (web_attributes.supportOwnOffscreenSurface) { | 1024 attributes.depth_size = 0; |
| 1025 attributes.own_offscreen_surface = true; | 1025 attributes.stencil_size = 0; |
| 1026 attributes.low_priority = true; | 1026 attributes.samples = 0; |
| 1027 attributes.alpha_size = web_attributes.supportAlpha ? 8 : -1; | 1027 attributes.sample_buffers = 0; |
| 1028 attributes.depth_size = web_attributes.supportDepth ? 24 : 0; | |
| 1029 attributes.stencil_size = web_attributes.supportStencil ? 8 : 0; | |
| 1030 attributes.samples = web_attributes.supportAntialias ? 4 : 0; | |
| 1031 attributes.sample_buffers = 0; | |
| 1032 } else { | |
| 1033 attributes.depth_size = 0; | |
| 1034 attributes.stencil_size = 0; | |
| 1035 attributes.samples = 0; | |
| 1036 attributes.sample_buffers = 0; | |
| 1037 } | |
| 1038 attributes.bind_generates_resource = false; | 1028 attributes.bind_generates_resource = false; |
| 1039 // Prefer discrete GPU for WebGL. | 1029 // Prefer discrete GPU for WebGL. |
| 1040 attributes.gpu_preference = gl::PreferDiscreteGpu; | 1030 attributes.gpu_preference = gl::PreferDiscreteGpu; |
| 1041 | 1031 |
| 1042 attributes.fail_if_major_perf_caveat = | 1032 attributes.fail_if_major_perf_caveat = |
| 1043 web_attributes.failIfMajorPerformanceCaveat; | 1033 web_attributes.failIfMajorPerformanceCaveat; |
| 1044 | |
| 1045 DCHECK_GT(web_attributes.webGLVersion, 0u); | 1034 DCHECK_GT(web_attributes.webGLVersion, 0u); |
| 1046 DCHECK_LE(web_attributes.webGLVersion, 2u); | 1035 DCHECK_LE(web_attributes.webGLVersion, 2u); |
| 1047 if (web_attributes.webGLVersion == 2) | 1036 if (web_attributes.webGLVersion == 2) |
| 1048 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; | 1037 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; |
| 1049 else | 1038 else |
| 1050 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; | 1039 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; |
| 1051 | 1040 |
| 1052 constexpr bool automatic_flushes = true; | 1041 constexpr bool automatic_flushes = true; |
| 1053 constexpr bool support_locking = false; | 1042 constexpr bool support_locking = false; |
| 1054 | 1043 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 return &trial_token_validator_; | 1285 return &trial_token_validator_; |
| 1297 } | 1286 } |
| 1298 | 1287 |
| 1299 void RendererBlinkPlatformImpl::workerContextCreated( | 1288 void RendererBlinkPlatformImpl::workerContextCreated( |
| 1300 const v8::Local<v8::Context>& worker) { | 1289 const v8::Local<v8::Context>& worker) { |
| 1301 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( | 1290 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( |
| 1302 worker); | 1291 worker); |
| 1303 } | 1292 } |
| 1304 | 1293 |
| 1305 } // namespace content | 1294 } // namespace content |
| OLD | NEW |