| 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 <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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "content/renderer/media/renderer_webaudiodevice_impl.h" | 68 #include "content/renderer/media/renderer_webaudiodevice_impl.h" |
| 69 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" | 69 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
| 70 #include "content/renderer/media/rtc_certificate_generator.h" | 70 #include "content/renderer/media/rtc_certificate_generator.h" |
| 71 #include "content/renderer/mojo/blink_service_registry_impl.h" | 71 #include "content/renderer/mojo/blink_service_registry_impl.h" |
| 72 #include "content/renderer/render_thread_impl.h" | 72 #include "content/renderer/render_thread_impl.h" |
| 73 #include "content/renderer/renderer_clipboard_delegate.h" | 73 #include "content/renderer/renderer_clipboard_delegate.h" |
| 74 #include "content/renderer/screen_orientation/screen_orientation_observer.h" | 74 #include "content/renderer/screen_orientation/screen_orientation_observer.h" |
| 75 #include "content/renderer/webclipboard_impl.h" | 75 #include "content/renderer/webclipboard_impl.h" |
| 76 #include "content/renderer/webgraphicscontext3d_provider_impl.h" | 76 #include "content/renderer/webgraphicscontext3d_provider_impl.h" |
| 77 #include "content/renderer/webpublicsuffixlist_impl.h" | 77 #include "content/renderer/webpublicsuffixlist_impl.h" |
| 78 #include "gpu/command_buffer/client/gles2_interface.h" |
| 78 #include "gpu/config/gpu_info.h" | 79 #include "gpu/config/gpu_info.h" |
| 79 #include "gpu/ipc/client/gpu_channel_host.h" | 80 #include "gpu/ipc/client/gpu_channel_host.h" |
| 80 #include "ipc/ipc_sync_message_filter.h" | 81 #include "ipc/ipc_sync_message_filter.h" |
| 81 #include "media/audio/audio_output_device.h" | 82 #include "media/audio/audio_output_device.h" |
| 82 #include "media/base/audio_hardware_config.h" | 83 #include "media/base/audio_hardware_config.h" |
| 83 #include "media/base/mime_util.h" | 84 #include "media/base/mime_util.h" |
| 84 #include "media/blink/webcontentdecryptionmodule_impl.h" | 85 #include "media/blink/webcontentdecryptionmodule_impl.h" |
| 85 #include "media/filters/stream_parser_factory.h" | 86 #include "media/filters/stream_parser_factory.h" |
| 86 #include "storage/common/database/database_identifier.h" | 87 #include "storage/common/database/database_identifier.h" |
| 87 #include "storage/common/quota/quota_types.h" | 88 #include "storage/common/quota/quota_types.h" |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client); | 969 return GetContentClient()->renderer()->OverrideSpeechSynthesizer(client); |
| 969 } | 970 } |
| 970 | 971 |
| 971 //------------------------------------------------------------------------------ | 972 //------------------------------------------------------------------------------ |
| 972 | 973 |
| 973 static void Collect3DContextInformationOnFailure( | 974 static void Collect3DContextInformationOnFailure( |
| 974 blink::Platform::GraphicsInfo* gl_info, | 975 blink::Platform::GraphicsInfo* gl_info, |
| 975 gpu::GpuChannelHost* host) { | 976 gpu::GpuChannelHost* host) { |
| 976 DCHECK(gl_info); | 977 DCHECK(gl_info); |
| 977 std::string error_message("OffscreenContext Creation failed, "); | 978 std::string error_message("OffscreenContext Creation failed, "); |
| 978 if (host) { | 979 const gpu::GPUInfo& gpu_info = host->gpu_info(); |
| 979 const gpu::GPUInfo& gpu_info = host->gpu_info(); | 980 gl_info->vendorId = gpu_info.gpu.vendor_id; |
| 980 gl_info->vendorId = gpu_info.gpu.vendor_id; | 981 gl_info->deviceId = gpu_info.gpu.device_id; |
| 981 gl_info->deviceId = gpu_info.gpu.device_id; | 982 switch (gpu_info.context_info_state) { |
| 982 switch (gpu_info.context_info_state) { | 983 case gpu::kCollectInfoSuccess: |
| 983 case gpu::kCollectInfoSuccess: | 984 case gpu::kCollectInfoNonFatalFailure: |
| 984 case gpu::kCollectInfoNonFatalFailure: | 985 gl_info->rendererInfo = WebString::fromUTF8(gpu_info.gl_renderer); |
| 985 gl_info->rendererInfo = WebString::fromUTF8(gpu_info.gl_renderer); | 986 gl_info->vendorInfo = WebString::fromUTF8(gpu_info.gl_vendor); |
| 986 gl_info->vendorInfo = WebString::fromUTF8(gpu_info.gl_vendor); | 987 gl_info->driverVersion = WebString::fromUTF8(gpu_info.driver_version); |
| 987 gl_info->driverVersion = WebString::fromUTF8(gpu_info.driver_version); | 988 gl_info->resetNotificationStrategy = |
| 988 gl_info->resetNotificationStrategy = | 989 gpu_info.gl_reset_notification_strategy; |
| 989 gpu_info.gl_reset_notification_strategy; | 990 gl_info->sandboxed = gpu_info.sandboxed; |
| 990 gl_info->sandboxed = gpu_info.sandboxed; | 991 gl_info->processCrashCount = gpu_info.process_crash_count; |
| 991 gl_info->processCrashCount = gpu_info.process_crash_count; | 992 gl_info->amdSwitchable = gpu_info.amd_switchable; |
| 992 gl_info->amdSwitchable = gpu_info.amd_switchable; | 993 gl_info->optimus = gpu_info.optimus; |
| 993 gl_info->optimus = gpu_info.optimus; | 994 break; |
| 994 break; | 995 case gpu::kCollectInfoFatalFailure: |
| 995 case gpu::kCollectInfoFatalFailure: | 996 case gpu::kCollectInfoNone: |
| 996 case gpu::kCollectInfoNone: | 997 error_message.append( |
| 997 error_message.append( | 998 "Failed to collect gpu information, GLSurface or GLContext " |
| 998 "Failed to collect gpu information, GLSurface or GLContext " | 999 "creation failed"); |
| 999 "creation failed"); | 1000 gl_info->errorMessage = WebString::fromUTF8(error_message); |
| 1000 gl_info->errorMessage = WebString::fromUTF8(error_message); | 1001 break; |
| 1001 break; | 1002 default: |
| 1002 default: | 1003 NOTREACHED(); |
| 1003 NOTREACHED(); | |
| 1004 } | |
| 1005 } else { | |
| 1006 error_message.append("GpuChannelHost creation failed"); | |
| 1007 gl_info->errorMessage = WebString::fromUTF8(error_message); | |
| 1008 } | 1004 } |
| 1009 } | 1005 } |
| 1010 | 1006 |
| 1011 blink::WebGraphicsContext3DProvider* | 1007 blink::WebGraphicsContext3DProvider* |
| 1012 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3DProvider( | 1008 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3DProvider( |
| 1013 const blink::Platform::ContextAttributes& web_attributes, | 1009 const blink::Platform::ContextAttributes& web_attributes, |
| 1014 const blink::WebURL& top_document_web_url, | 1010 const blink::WebURL& top_document_web_url, |
| 1015 blink::WebGraphicsContext3DProvider* share_provider, | 1011 blink::WebGraphicsContext3DProvider* share_provider, |
| 1016 blink::Platform::GraphicsInfo* gl_info) { | 1012 blink::Platform::GraphicsInfo* gl_info) { |
| 1017 DCHECK(gl_info); | 1013 DCHECK(gl_info); |
| 1018 if (!RenderThreadImpl::current()) { | 1014 if (!RenderThreadImpl::current()) { |
| 1019 std::string error_message("Failed to run in Current RenderThreadImpl"); | 1015 std::string error_message("Failed to run in Current RenderThreadImpl"); |
| 1020 gl_info->errorMessage = WebString::fromUTF8(error_message); | 1016 gl_info->errorMessage = WebString::fromUTF8(error_message); |
| 1021 return nullptr; | 1017 return nullptr; |
| 1022 } | 1018 } |
| 1023 | 1019 |
| 1024 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( | 1020 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host( |
| 1025 RenderThreadImpl::current()->EstablishGpuChannelSync( | 1021 RenderThreadImpl::current()->EstablishGpuChannelSync( |
| 1026 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 1022 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
| 1023 if (!gpu_channel_host) { |
| 1024 std::string error_message( |
| 1025 "OffscreenContext Creation failed, GpuChannelHost creation failed"); |
| 1026 gl_info->errorMessage = WebString::fromUTF8(error_message); |
| 1027 return nullptr; |
| 1028 } |
| 1029 |
| 1030 // WebGL contexts must fail creation if the share group is lost. |
| 1031 if (share_provider && |
| 1032 share_provider->contextGL()->GetGraphicsResetStatusKHR() != GL_NO_ERROR) { |
| 1033 std::string error_message( |
| 1034 "OffscreenContext Creation failed, Shared context is lost"); |
| 1035 gl_info->errorMessage = WebString::fromUTF8(error_message); |
| 1036 return nullptr; |
| 1037 } |
| 1027 | 1038 |
| 1028 WebGraphicsContext3DCommandBufferImpl* share_context = | 1039 WebGraphicsContext3DCommandBufferImpl* share_context = |
| 1029 share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>( | 1040 share_provider ? static_cast<WebGraphicsContext3DCommandBufferImpl*>( |
| 1030 share_provider->context3d()) | 1041 share_provider->context3d()) |
| 1031 : nullptr; | 1042 : nullptr; |
| 1032 | 1043 |
| 1033 // This is an offscreen context, which doesn't use the default frame buffer, | 1044 // This is an offscreen context, which doesn't use the default frame buffer, |
| 1034 // so don't request any alpha, depth, stencil, antialiasing. | 1045 // so don't request any alpha, depth, stencil, antialiasing. |
| 1035 gpu::gles2::ContextCreationAttribHelper attributes; | 1046 gpu::gles2::ContextCreationAttribHelper attributes; |
| 1036 attributes.alpha_size = -1; | 1047 attributes.alpha_size = -1; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 } | 1297 } |
| 1287 | 1298 |
| 1288 //------------------------------------------------------------------------------ | 1299 //------------------------------------------------------------------------------ |
| 1289 | 1300 |
| 1290 blink::WebTrialTokenValidator* | 1301 blink::WebTrialTokenValidator* |
| 1291 RendererBlinkPlatformImpl::trialTokenValidator() { | 1302 RendererBlinkPlatformImpl::trialTokenValidator() { |
| 1292 return &trial_token_validator_; | 1303 return &trial_token_validator_; |
| 1293 } | 1304 } |
| 1294 | 1305 |
| 1295 } // namespace content | 1306 } // namespace content |
| OLD | NEW |