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

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

Issue 1844363003: Move WebGraphicsContext3D::Attributes to Platform::ContextAttributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rm-alphadepthetc
Patch Set: move-attributes: rebase Created 4 years, 8 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
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 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 NOTREACHED(); 999 NOTREACHED();
1000 } 1000 }
1001 } else { 1001 } else {
1002 error_message.append("GpuChannelHost creation failed"); 1002 error_message.append("GpuChannelHost creation failed");
1003 gl_info->errorMessage = WebString::fromUTF8(error_message); 1003 gl_info->errorMessage = WebString::fromUTF8(error_message);
1004 } 1004 }
1005 } 1005 }
1006 1006
1007 blink::WebGraphicsContext3DProvider* 1007 blink::WebGraphicsContext3DProvider*
1008 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3DProvider( 1008 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3DProvider(
1009 const blink::WebGraphicsContext3D::Attributes& web_attributes, 1009 const blink::Platform::ContextAttributes& web_attributes,
1010 const blink::WebURL& top_document_web_url,
1010 blink::WebGraphicsContext3DProvider* share_provider, 1011 blink::WebGraphicsContext3DProvider* share_provider,
1011 blink::Platform::GraphicsInfo* gl_info) { 1012 blink::Platform::GraphicsInfo* gl_info) {
1012 DCHECK(gl_info); 1013 DCHECK(gl_info);
1013 if (!RenderThreadImpl::current()) { 1014 if (!RenderThreadImpl::current()) {
1014 std::string error_message("Failed to run in Current RenderThreadImpl"); 1015 std::string error_message("Failed to run in Current RenderThreadImpl");
1015 gl_info->errorMessage = WebString::fromUTF8(error_message); 1016 gl_info->errorMessage = WebString::fromUTF8(error_message);
1016 return nullptr; 1017 return nullptr;
1017 } 1018 }
1018 1019
1019 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( 1020 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host(
(...skipping 21 matching lines...) Expand all
1041 if (web_attributes.webGLVersion == 1) 1042 if (web_attributes.webGLVersion == 1)
1042 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1; 1043 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL1;
1043 else if (web_attributes.webGLVersion == 2) 1044 else if (web_attributes.webGLVersion == 2)
1044 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2; 1045 attributes.context_type = gpu::gles2::CONTEXT_TYPE_WEBGL2;
1045 1046
1046 bool share_resources = web_attributes.shareResources; 1047 bool share_resources = web_attributes.shareResources;
1047 bool automatic_flushes = !web_attributes.noAutomaticFlushes; 1048 bool automatic_flushes = !web_attributes.noAutomaticFlushes;
1048 gfx::GpuPreference gpu_preference = web_attributes.preferDiscreteGPU 1049 gfx::GpuPreference gpu_preference = web_attributes.preferDiscreteGPU
1049 ? gfx::PreferDiscreteGpu 1050 ? gfx::PreferDiscreteGpu
1050 : gfx::PreferIntegratedGpu; 1051 : gfx::PreferIntegratedGpu;
1051 GURL url = blink::WebStringToGURL(web_attributes.topDocumentURL);
1052 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; 1052 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
1053 1053
1054 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( 1054 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
1055 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 1055 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
1056 gpu_channel_host.get(), attributes, gpu_preference, share_resources, 1056 gpu_channel_host.get(), attributes, gpu_preference, share_resources,
1057 automatic_flushes, url, limits, share_context)); 1057 automatic_flushes, GURL(top_document_web_url), limits,
1058 share_context));
1058 scoped_refptr<ContextProviderCommandBuffer> provider = 1059 scoped_refptr<ContextProviderCommandBuffer> provider =
1059 ContextProviderCommandBuffer::Create(std::move(context), 1060 ContextProviderCommandBuffer::Create(std::move(context),
1060 RENDERER_MAINTHREAD_CONTEXT); 1061 RENDERER_MAINTHREAD_CONTEXT);
1061 if (!provider || !provider->BindToCurrentThread()) { 1062 if (!provider || !provider->BindToCurrentThread()) {
1062 // Collect Graphicsinfo if there is a context failure or it is failed 1063 // Collect Graphicsinfo if there is a context failure or it is failed
1063 // purposefully in case of layout tests. 1064 // purposefully in case of layout tests.
1064 Collect3DContextInformationOnFailure(gl_info, gpu_channel_host.get()); 1065 Collect3DContextInformationOnFailure(gl_info, gpu_channel_host.get());
1065 return nullptr; 1066 return nullptr;
1066 } 1067 }
1067 return new WebGraphicsContext3DProviderImpl(std::move(provider)); 1068 return new WebGraphicsContext3DProviderImpl(std::move(provider));
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 } 1287 }
1287 1288
1288 //------------------------------------------------------------------------------ 1289 //------------------------------------------------------------------------------
1289 1290
1290 blink::WebTrialTokenValidator* 1291 blink::WebTrialTokenValidator*
1291 RendererBlinkPlatformImpl::trialTokenValidator() { 1292 RendererBlinkPlatformImpl::trialTokenValidator() {
1292 return &trial_token_validator_; 1293 return &trial_token_validator_;
1293 } 1294 }
1294 1295
1295 } // namespace content 1296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698