Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: content/renderer/renderer_blink_platform_impl.cc

Issue 2107783003: Pass initial size and GPU preference via context attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 1078
1079 // This is an offscreen context, which doesn't use the default frame buffer, 1079 // This is an offscreen context, which doesn't use the default frame buffer,
1080 // so don't request any alpha, depth, stencil, antialiasing. 1080 // so don't request any alpha, depth, stencil, antialiasing.
1081 gpu::gles2::ContextCreationAttribHelper attributes; 1081 gpu::gles2::ContextCreationAttribHelper attributes;
1082 attributes.alpha_size = -1; 1082 attributes.alpha_size = -1;
1083 attributes.depth_size = 0; 1083 attributes.depth_size = 0;
1084 attributes.stencil_size = 0; 1084 attributes.stencil_size = 0;
1085 attributes.samples = 0; 1085 attributes.samples = 0;
1086 attributes.sample_buffers = 0; 1086 attributes.sample_buffers = 0;
1087 attributes.bind_generates_resource = false; 1087 attributes.bind_generates_resource = false;
1088 // Prefer discrete GPU for WebGL.
1089 attributes.gpu_preference = gl::PreferDiscreteGpu;
1088 1090
1089 attributes.fail_if_major_perf_caveat = 1091 attributes.fail_if_major_perf_caveat =
1090 web_attributes.failIfMajorPerformanceCaveat; 1092 web_attributes.failIfMajorPerformanceCaveat;
1091 DCHECK_GT(web_attributes.webGLVersion, 0u); 1093 DCHECK_GT(web_attributes.webGLVersion, 0u);
1092 DCHECK_LE(web_attributes.webGLVersion, 2u); 1094 DCHECK_LE(web_attributes.webGLVersion, 2u);
1093 if (web_attributes.webGLVersion == 2) 1095 if (web_attributes.webGLVersion == 2)
1094 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; 1096 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2;
1095 else 1097 else
1096 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; 1098 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1;
1097 1099
1098 constexpr bool automatic_flushes = true; 1100 constexpr bool automatic_flushes = true;
1099 constexpr bool support_locking = false; 1101 constexpr bool support_locking = false;
1100 // Prefer discrete GPU for WebGL.
1101 constexpr gl::GpuPreference gpu_preference = gl::PreferDiscreteGpu;
1102 1102
1103 scoped_refptr<ContextProviderCommandBuffer> provider( 1103 scoped_refptr<ContextProviderCommandBuffer> provider(
1104 new ContextProviderCommandBuffer( 1104 new ContextProviderCommandBuffer(
1105 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT, 1105 std::move(gpu_channel_host), gpu::GPU_STREAM_DEFAULT,
1106 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle, 1106 gpu::GpuStreamPriority::NORMAL, gpu::kNullSurfaceHandle,
1107 GURL(top_document_web_url), gpu_preference, automatic_flushes, 1107 GURL(top_document_web_url), automatic_flushes, support_locking,
1108 support_locking, gpu::SharedMemoryLimits(), attributes, share_context, 1108 gpu::SharedMemoryLimits(), attributes, share_context,
1109 command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_WEBGL)); 1109 command_buffer_metrics::OFFSCREEN_CONTEXT_FOR_WEBGL));
1110 return new WebGraphicsContext3DProviderImpl(std::move(provider)); 1110 return new WebGraphicsContext3DProviderImpl(std::move(provider));
1111 } 1111 }
1112 1112
1113 //------------------------------------------------------------------------------ 1113 //------------------------------------------------------------------------------
1114 1114
1115 blink::WebGraphicsContext3DProvider* 1115 blink::WebGraphicsContext3DProvider*
1116 RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() { 1116 RendererBlinkPlatformImpl::createSharedOffscreenGraphicsContext3DProvider() {
1117 scoped_refptr<ContextProviderCommandBuffer> provider = 1117 scoped_refptr<ContextProviderCommandBuffer> provider =
1118 RenderThreadImpl::current()->SharedMainThreadContextProvider(); 1118 RenderThreadImpl::current()->SharedMainThreadContextProvider();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1309 return &trial_token_validator_; 1309 return &trial_token_validator_;
1310 } 1310 }
1311 1311
1312 void RendererBlinkPlatformImpl::workerContextCreated( 1312 void RendererBlinkPlatformImpl::workerContextCreated(
1313 const v8::Local<v8::Context>& worker) { 1313 const v8::Local<v8::Context>& worker) {
1314 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread( 1314 GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
1315 worker); 1315 worker);
1316 } 1316 }
1317 1317
1318 } // namespace content 1318 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | content/test/layouttest_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698