Chromium Code Reviews| Index: content/renderer/renderer_blink_platform_impl.cc |
| diff --git a/content/renderer/renderer_blink_platform_impl.cc b/content/renderer/renderer_blink_platform_impl.cc |
| index 9da0779e3e3309e6ce6441910692dfea95ee39d8..79ffad6d2e63f19b4fd8bb9668c918411b6bb4a9 100644 |
| --- a/content/renderer/renderer_blink_platform_impl.cc |
| +++ b/content/renderer/renderer_blink_platform_impl.cc |
| @@ -976,42 +976,62 @@ RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| return createOffscreenGraphicsContext3D(attributes, share_context, NULL); |
| } |
| -blink::WebGraphicsContext3D* |
| -RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| - const blink::WebGraphicsContext3D::Attributes& attributes, |
| +static void collect3DContextInformationOnFailure( |
|
piman
2015/10/20 01:45:04
nit: this is chromium code, please use chromium st
sivag
2015/10/20 10:14:41
Done.
sivag
2015/10/20 10:14:41
Done.
|
| blink::WebGraphicsContext3D* share_context, |
| - blink::WebGLInfo* gl_info) { |
| - if (!RenderThreadImpl::current()) |
| - return NULL; |
| - |
| - scoped_refptr<GpuChannelHost> gpu_channel_host( |
| - RenderThreadImpl::current()->EstablishGpuChannelSync( |
| - CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| - |
| - if (gpu_channel_host.get() && gl_info) { |
| - const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info(); |
| + blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info, |
| + GpuChannelHost* host) { |
| + if (!gl_info) |
| + return; |
|
Zhenyao Mo
2015/10/19 17:44:48
nit: maybe DCHECK(gl_info)? because caller makes s
sivag
2015/10/20 10:14:41
Done.
|
| + std::string errorMessage("OffscreenContext Creation failed, "); |
|
piman
2015/10/20 01:45:04
nit: Chromium style (error_message)
sivag
2015/10/20 10:14:41
Done.
|
| + if (host) { |
| + const gpu::GPUInfo& gpu_info = host->gpu_info(); |
| + gl_info->vendorId = gpu_info.gpu.vendor_id; |
| + gl_info->deviceId = gpu_info.gpu.device_id; |
| switch (gpu_info.context_info_state) { |
| case gpu::kCollectInfoSuccess: |
| case gpu::kCollectInfoNonFatalFailure: |
| - gl_info->vendorInfo.assign( |
| - blink::WebString::fromUTF8(gpu_info.gl_vendor)); |
| - gl_info->rendererInfo.assign( |
| - blink::WebString::fromUTF8(gpu_info.gl_renderer)); |
| - gl_info->driverVersion.assign( |
| - blink::WebString::fromUTF8(gpu_info.driver_version)); |
| - gl_info->vendorId = gpu_info.gpu.vendor_id; |
| - gl_info->deviceId = gpu_info.gpu.device_id; |
| + gl_info->rendererInfo = WebString::fromUTF8(gpu_info.gl_renderer); |
| + gl_info->vendorInfo = WebString::fromUTF8(gpu_info.gl_vendor); |
| + gl_info->driverVersion = WebString::fromUTF8(gpu_info.driver_version); |
| + gl_info->resetNotificationStrategy = |
| + gpu_info.gl_reset_notification_strategy; |
| + gl_info->sandboxed = gpu_info.sandboxed; |
| + gl_info->processCrashCount = gpu_info.process_crash_count; |
| + gl_info->amdSwitchable = gpu_info.amd_switchable; |
| + gl_info->optimus = gpu_info.optimus; |
| break; |
| case gpu::kCollectInfoFatalFailure: |
| case gpu::kCollectInfoNone: |
| - gl_info->contextInfoCollectionFailure.assign(blink::WebString::fromUTF8( |
| - "GPUInfoCollectionFailure: GPU initialization Failed. GPU " |
| - "Info not Collected.")); |
| + errorMessage.append( |
| + "Failed to collect gpu information, GLSurface or GLContext " |
| + "creation failed"); |
| + gl_info->errorMessage = WebString::fromUTF8(errorMessage); |
| break; |
| default: |
| NOTREACHED(); |
| } |
| + } else { |
| + errorMessage.append("GpuChannelHost creation failed"); |
| + gl_info->errorMessage = WebString::fromUTF8(errorMessage); |
| } |
| +} |
| + |
| +blink::WebGraphicsContext3D* |
| +RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| + const blink::WebGraphicsContext3D::Attributes& attributes, |
| + blink::WebGraphicsContext3D* share_context, |
| + blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) { |
| + if (!RenderThreadImpl::current()) { |
| + if (gl_info) { |
| + std::string errorMessage("Failed to run in Current RenderThreadImpl"); |
| + gl_info->errorMessage = WebString::fromUTF8(errorMessage); |
| + return NULL; |
| + } |
| + } |
| + |
| + scoped_refptr<GpuChannelHost> gpu_channel_host( |
| + RenderThreadImpl::current()->EstablishGpuChannelSync( |
| + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)); |
| WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
| bool lose_context_when_out_of_memory = false; |
| @@ -1026,8 +1046,14 @@ RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| // Most likely the GPU process exited and the attempt to reconnect to it |
| // failed. Need to try to restore the context again later. |
| - if (!context || !context->InitializeOnCurrentThread()) |
| - return NULL; |
| + if (!context || !context->InitializeOnCurrentThread() || |
| + (gl_info && gl_info->testFailContext)) { |
| + // Collect Graphicsinfo if there is a context failure or it is failed |
| + // purposefully in caseof layout tests. |
|
Zhenyao Mo
2015/10/19 17:44:48
nit: caseof -> case of
sivag
2015/10/20 10:14:41
Done.
|
| + collect3DContextInformationOnFailure(share_context, gl_info, |
| + gpu_channel_host.get()); |
| + return NULL; |
| + } |
| return context.release(); |
| } |