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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 blink::WebGraphicsContext3D* | 929 blink::WebGraphicsContext3D* |
930 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 930 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
931 const blink::WebGraphicsContext3D::Attributes& attributes) { | 931 const blink::WebGraphicsContext3D::Attributes& attributes) { |
932 return createOffscreenGraphicsContext3D(attributes, NULL); | 932 return createOffscreenGraphicsContext3D(attributes, NULL); |
933 } | 933 } |
934 | 934 |
935 blink::WebGraphicsContext3D* | 935 blink::WebGraphicsContext3D* |
936 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( | 936 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
937 const blink::WebGraphicsContext3D::Attributes& attributes, | 937 const blink::WebGraphicsContext3D::Attributes& attributes, |
938 blink::WebGraphicsContext3D* share_context) { | 938 blink::WebGraphicsContext3D* share_context) { |
| 939 return createOffscreenGraphicsContext3D(attributes, share_context, NULL); |
| 940 } |
| 941 |
| 942 blink::WebGraphicsContext3D* |
| 943 RendererBlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 944 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 945 blink::WebGraphicsContext3D* share_context, |
| 946 blink::WebGLInfo* gl_info) { |
939 if (!RenderThreadImpl::current()) | 947 if (!RenderThreadImpl::current()) |
940 return NULL; | 948 return NULL; |
941 | 949 |
942 #if defined(OS_ANDROID) | 950 #if defined(OS_ANDROID) |
943 if (SynchronousCompositorFactory* factory = | 951 if (SynchronousCompositorFactory* factory = |
944 SynchronousCompositorFactory::GetInstance()) { | 952 SynchronousCompositorFactory::GetInstance()) { |
945 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> | 953 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl> |
946 in_process_context( | 954 in_process_context( |
947 factory->CreateOffscreenGraphicsContext3D(attributes)); | 955 factory->CreateOffscreenGraphicsContext3D(attributes)); |
948 if (!in_process_context || | 956 if (!in_process_context || |
949 !in_process_context->InitializeOnCurrentThread()) | 957 !in_process_context->InitializeOnCurrentThread()) |
950 return NULL; | 958 return NULL; |
951 return in_process_context.release(); | 959 return in_process_context.release(); |
952 } | 960 } |
953 #endif | 961 #endif |
954 | 962 |
955 scoped_refptr<GpuChannelHost> gpu_channel_host( | 963 scoped_refptr<GpuChannelHost> gpu_channel_host( |
956 RenderThreadImpl::current()->EstablishGpuChannelSync( | 964 RenderThreadImpl::current()->EstablishGpuChannelSync( |
957 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 965 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
958 | 966 |
| 967 if (gpu_channel_host.get() && gl_info) { |
| 968 const gpu::GPUInfo& gpu_info = gpu_channel_host->gpu_info(); |
| 969 gl_info->vendorInfo.assign(blink::WebString::fromUTF8(gpu_info.gl_vendor)); |
| 970 gl_info->rendererInfo.assign( |
| 971 blink::WebString::fromUTF8(gpu_info.gl_renderer)); |
| 972 gl_info->driverVersion.assign( |
| 973 blink::WebString::fromUTF8(gpu_info.gl_version)); |
| 974 } |
| 975 |
959 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; | 976 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits; |
960 bool lose_context_when_out_of_memory = false; | 977 bool lose_context_when_out_of_memory = false; |
961 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 978 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
962 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 979 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
963 gpu_channel_host.get(), | 980 gpu_channel_host.get(), |
964 attributes, | 981 attributes, |
965 lose_context_when_out_of_memory, | 982 lose_context_when_out_of_memory, |
966 GURL(attributes.topDocumentURL), | 983 GURL(attributes.topDocumentURL), |
967 limits, | 984 limits, |
968 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); | 985 static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context))); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( | 1188 void RendererBlinkPlatformImpl::MockBatteryStatusChangedForTesting( |
1172 const blink::WebBatteryStatus& status) { | 1189 const blink::WebBatteryStatus& status) { |
1173 PlatformEventObserverBase* observer = | 1190 PlatformEventObserverBase* observer = |
1174 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); | 1191 platform_event_observers_.Lookup(blink::WebPlatformEventBattery); |
1175 if (!observer) | 1192 if (!observer) |
1176 return; | 1193 return; |
1177 observer->SendFakeDataForTesting((void*)&status); | 1194 observer->SendFakeDataForTesting((void*)&status); |
1178 } | 1195 } |
1179 | 1196 |
1180 } // namespace content | 1197 } // namespace content |
OLD | NEW |